[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
DefaultQuartzSchedulerThread  XML
Forum Index -> Quartz
Author Message
dhanushg

neo

Joined: 12/02/2009 23:53:30
Messages: 1
Offline

Hi,

I am using the Quartz Scheduler in my J2EE Application and I am using it for the first time. I instantiate the scheduler factory using the QuartzInitializerListener.

Here is my configuration in web. xml
Code:
 <context-param>
 		<param-name>config-file</param-name>
 		<param-value>WEB-INF/epm_quartz.properties</param-value>
 	</context-param>
 	<context-param>
 		<param-name>shutdown-on-unload</param-name>
 		<param-value>true</param-value>
 	</context-param>
 	<context-param>
 		<param-name>start-scheduler-on-load</param-name>
 		<param-value>false</param-value>
 	</context-param>
 	<listener>
 		<listener-class>
 			org.quartz.ee.servlet.QuartzInitializerListener
 		</listener-class>
 	</listener>
 


The quartz properties files is as below
Code:
org.quartz.scheduler.instanceName = DefaultQuartzScheduler
 org.quartz.scheduler.rmi.export = false
 org.quartz.scheduler.rmi.proxy = false
 org.quartz.scheduler.wrapJobExecutionInUserTransaction = false
 org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
 org.quartz.threadPool.threadCount = 1
 org.quartz.threadPool.threadPriority = 5
 org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true
 org.quartz.jobStore.misfireThreshold = 60000
 org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore


I have a my own Application Context Listener where I instantiate the Scheduler.

Code:
 	//get the servlet context
 ServletContext servletContext = arg0.getServletContext();
 			// get the scheduler factory
 StdSchedulerFactory factory = (StdSchedulerFactory) servletContext
 					.getAttribute(QuartzInitializerListener.QUARTZ_FACTORY_KEY);
 
 Scheduler sched = factory.getScheduler();
 sched.start();
 String jobName ="MyJob"
 // initialize the jobDetail class
 JobDetail jobDetail = new JobDetail(jobName, sched.DEFAULT_GROUP,
 					MyJob.class);
 			// seconds
 Trigger trigger = TriggerUtils.makeSecondlyTrigger(300);			
 trigger.setStartTime(new Date());
 trigger.setName(jobName);
 sched.scheduleJob(jobDetail, trigger);


This is how I initialize the scheduler and the scheduler works fine.
But the problem is that whenever the application server starts up there are 10 Worker Threads with the name DefaultQuartzScheduler_Worker-X also waiting in addition to my single thread.

Why is this happening? My application is a lot more slower after the introduction of the scheduler. Is there any way by which I can stop the initiation of the 10 threads and have only mine started? Finally is my implementation of Quartz Scheduler for J2EE app correct?

Any help is much appreciated
Thanks in Advance

Best regards
Dhanush Gopinath
jhouse

seraphim
[Avatar]
Joined: 11/06/2009 15:29:56
Messages: 1703
Offline


Quartz must not be using your quartz.properties file, but must instead be "falling back" to the default one that is within the quartz.jar.

You could verify this by changing the name of the scheduler in your properties file, and seeing if the default name still shows up.

This is almost certainly a classpath problem. Make sure your quartz.properties is in your classpath before the quartz.jar, or that you give the full path to your quartz.properties file to the initializer.
 
Forum Index -> Quartz
Go to:   
Powered by JForum 2.1.7 © JForum Team