[Logo] Terracotta Discussion Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
How to get reference of running quartz Scheduler  XML
Forum Index -> Quartz
Author Message
sangram

journeyman

Joined: 06/27/2012 04:01:22
Messages: 28
Offline

Hi Team,

I am using a servlet say "QuartzServlet" that implements ServletContextListener. This servlet initializes the Scheduler using

Code:
SchedulerFactory sf = new StdSchedulerFactory("quartz.properties");
 Scheduler sched = sf.getScheduler();
 sched.start();


I want to use this scheduler instance in another servlet so that i can display the existing jobs and triggers in a jsp. Do i have to create a new instance once again like this

Code:
SchedulerFactory sf = new StdSchedulerFactory("quartz.properties");
 Scheduler scheduler = sf.getScheduler();


or get the running instance of the scheduler. If so, how can i get the instance. Please suggest me a solution for the above.

--
Thanks
pelly

neo

Joined: 07/02/2012 17:28:05
Messages: 4
Offline

Why not in session or in ServletContext? Also as an static field of the servlet?

You could use RMI every time but I do not think is worthy. My (almost) Quartz newbie opinion.

Adolfo
sangram

journeyman

Joined: 06/27/2012 04:01:22
Messages: 28
Offline

So, if i use it in session, then can i use that the scheduler instance any where in the application, i.e, in multiple servlets( one to add job&trigger, one to display jobs, one to start the instance). If so, can you please guide me how to use it in session.

--
Thanks


pelly wrote:
Why not in session or in ServletContext? Also as an static field of the servlet?

You could use RMI every time but I do not think is worthy. My (almost) Quartz newbie opinion.

Adolfo 
pelly

neo

Joined: 07/02/2012 17:28:05
Messages: 4
Offline

It is not a Quartz question but a servlets question:

http://stackoverflow.com/questions/123657/how-can-i-share-a-variable-or-object-between-two-or-more-servlets

Depends on your requirements and technologies that you are using. The drawback is, if attribute is non serializable it will be lost if you have clustering.

An alternative is sharing in ServletContext. (get/set) at application scope.
rajoshi

seraphim

Joined: 07/04/2011 04:36:10
Messages: 1461
Offline

Issue seems to be resolved closing the topic

Rakesh Joshi
Terracotta.
 
Forum Index -> Quartz
Go to:   
Powered by JForum 2.1.7 © JForum Team