if (this.scheduler != null)
{
throw new UnsupportedOperationException("the scheduler is started already");
}
SchedulerFactory schedulerFactory = null;
try
{
Properties properties = new Properties();
properties.put(StdSchedulerFactory.PROP_SCHED_JOB_FACTORY_CLASS, CdiAwareJobFactory.class.getName());
try
{
ResourceBundle config = loadCustomQuartzConfig();
Enumeration<String> keys = config.getKeys();
String key;
while (keys.hasMoreElements())
{
key = keys.nextElement();
properties.put(key, config.getString(key));
}
}
catch (Exception e1)
{
LOG.info("no custom quartz-config file found. falling back to the default config provided by quartz.");
InputStream inputStream = null;
try
{
inputStream = ClassUtils.getClassLoader(null).getResourceAsStream("org/quartz/quartz.properties");
properties.load(inputStream);
}
catch (Exception e2)
{
LOG.warning("failed to load quartz default-config");
schedulerFactory = new StdSchedulerFactory();
}
finally
{
if (inputStream != null)
{
inputStream.close();
}
}
}
if (schedulerFactory == null)
{
schedulerFactory = new StdSchedulerFactory(properties);
}
}
catch (Exception e)
{
LOG.log(Level.WARNING, "fallback to default scheduler-factory", e);
schedulerFactory = new StdSchedulerFactory();
}
try
{
this.scheduler = schedulerFactory.getScheduler();
this.scheduler.getListenerManager().addJobListener(new InjectionAwareJobListener());
if (!this.scheduler.isStarted())
{
String delayedStart =