This doesn't look like it got processed, I'll send it again... -----Original Message----- From: Justin Crosbie Sent: 28 January 2002 12:50 To: 'Orion-Interest' Subject: RE: Job Scheduler pattern
Hi again, Thanks for the help on this. What I've done so far is this: 1. Implemented a java.util.Timer as a Singleton which is accessed from the servlet layer. 2. Implemented a class that extends TimerTask, which does a JNDI lookup of my EJB and invokes the appropriate method. 3. Call the Singleton from the servlet to schedule the TimerTasks as per client requests. (Plus save details to database) 4. Implemented another app to be called via the <client-module> tag which reschedules the previously scheduled TimerTasks. Thus I have my persistence. 5. The Singleton runs the ReScheduler whenever its recreated. 6. Run orion using the -userThreads parameter - this is necessary. So, as long as my Singleton class stays up, I should be OK. The problem is, some tasks might be scheduled for weeks or months away. How can I guarantee that it will fire at the scheduled time even if it is this long away? I understand that there may be several instances of the Singleton per classloader, thats OK, as long as its a finite amount. So. My question now is: Is this as robust as it gets? Is there anything I am not doing, or could do to implement a better solution? All opinions welcome. Thanks again, Justin -----Original Message----- From: Paul Knepper [mailto:[EMAIL PROTECTED]] Sent: 25 January 2002 23:07 To: Orion-Interest Cc: '[EMAIL PROTECTED]' Subject: RE: Job Scheduler pattern Joseph, Very cool. How do you stop a client-module that auto-started and then restart it? Say you deployed the app (which also has ejb and web modules) and later wanted to add another task to the scheduler. Can you start and stop the java client module, so that it would reload the properties file, without affecting the web module? I might have users logged in to the website and I wouldn't want to redeploy everthing and messup any current sessions. Thanks, Paul -----Original Message----- From: Joseph B. Ottinger [mailto:[EMAIL PROTECTED]] Sent: Friday, January 25, 2002 4:04 AM To: Orion-Interest Subject: Re: Job Scheduler pattern The www.orionsupport.com site has a sample scheduler that can easily be converted to do something like this. On Fri, 25 Jan 2002, Justin Crosbie wrote: > Hi, > > I'm not sure if I've asked this before, or if I should be asking on a > general EJB list. > > I'd like to implement a job scheduler in J2EE. This would shcedule the > execution of EJB methods at a specified time in the future. It would have to > be persistent, and jobsd would be rescheduled upon appserver restart. > > Is it as simple as using the Timer and TimerTask in java.util to implement > an app that is started with the <client-module> tag? > > Does it matter as far as Orion goes whether I use a java.util.Timer as a > daemon or not? > > What can I do if the app, or the Timer object dies at any stage? > > I've had problems where after some time something goes wrong I get a strange > Remote Exception, and the only solution is to restart the VM. What might > cause this? > > Any opinions on this? How do I make this solution robust is what I am > asking. > > Thanks for any help, > Justin > ----------------------------------------------------------- Joseph B. Ottinger [EMAIL PROTECTED] http://adjacency.org/ IT Consultant