<commit_before>package com.zyeeda.framework.scheduler.internal;

import org.apache.tapestry5.ioc.ServiceResources;
import org.quartz.Job;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.spi.JobFactory;
import org.quartz.spi.TriggerFiredBundle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TapestryIocJobFactory implements JobFactory {
	
	private final static Logger logger = LoggerFactory.getLogger(TapestryIocJobFactory.class);
	
	private ServiceResources resources;
	
	public TapestryIocJobFactory(ServiceResources resources) {
		this.resources = resources;
	}

	@Override
	public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws SchedulerException {
		JobDetail detail = bundle.getJobDetail();
		Class<? extends Job> jobClass = detail.getJobClass();
		logger.debug("Fetch job class {} from Tapestry IoC container", jobClass.getSimpleName());
		return this.resources.getService(jobClass);
	}

}<commit_msg>must get job instance via serviceId not only class type<commit_after>package com.zyeeda.framework.scheduler.internal;

import org.apache.tapestry5.ioc.ServiceResources;
import org.quartz.Job;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.spi.JobFactory;
import org.quartz.spi.TriggerFiredBundle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.zyeeda.framework.utils.IocUtils;

public class TapestryIocJobFactory implements JobFactory {
	
	private final static Logger logger = LoggerFactory.getLogger(TapestryIocJobFactory.class);
	
	private ServiceResources resources;
	
	public TapestryIocJobFactory(ServiceResources resources) {
		this.resources = resources;
	}

	@Override
	public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws SchedulerException {
		JobDetail detail = bundle.getJobDetail();
		Class<? extends Job> jobClass = detail.getJobClass();
		logger.debug("Fetch job class {} from Tapestry IoC container", jobClass.getSimpleName());
		return this.resources.getService(IocUtils.getServiceId(jobClass), Job.class);
	}

}
{'fraction_non_alphanumeric': 0.08909512761020881, 'fraction_numerical': 0.0027842227378190253, 'mean_word_length': 6.283783783783784, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3755075', 'n_tokens_mistral': 676, 'n_tokens_neox': 632, 'n_words': 144}