[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]
Messages posted by: dhanushg  XML
Profile for dhanushg -> Messages posted by dhanushg [1]
Author Message
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
 
Profile for dhanushg -> Messages posted by dhanushg [1]
Go to:   
Powered by JForum 2.1.7 © JForum Team