I have done this using the java.util.Timer class. I created a class that extends the TimerTask class, and calls the EJB. I made a singleton class that wraps the Timer class, so I can call it from the servlet layer to schedule tasks, and guarantee only one instance per VM.
Thus, my EJBs aren't forking threads, so it should be OK. And the Timer instance, which controls the scheduling of the tasks, is always alive as long as my VM doesn't go down. I saved the schedule times and taskIds to the database so that they can be rescheduled when the appserver gets restarted. I created an application that reloads these jobs, and put this in <client-module> of orion-application.xml, so Orion would start it on startup. This works, and I haven't had any problems yet, but I'm not sure whether this is the best, or most valid approach. It feels a bit too easy to be any good. Alternatively, you can use a 3rd party job scheduler. This is free, and it has one: http://ofbiz.sourceforge.net/ http://ofbiz.sourceforge.net/core/docs/services.html I haven't had a chance to evaluate it. -----Original Message----- From: Johan Fredriksson [mailto:[EMAIL PROTECTED]] Sent: 13 March 2002 13:06 To: Orion-Interest Subject: Re: timed events Perhaps via a croned java client? //Johan ----- Original Message ----- From: "Casper Højstrup" <[EMAIL PROTECTED]> To: "Orion-Interest" <[EMAIL PROTECTED]> Sent: Wednesday, March 13, 2002 10:20 AM Subject: timed events > > This more of a regular EJB question, I suppose. > > I need to initiate some specific tasks and specific times in my application, since the application server aren't multithreaded(so to speak), and the usage of threads is not recommended, I cannot make a simple timer, that will initiate the appropriate procedures at a given time. > How do one solve such problems in an EJB application ? > > Regards > . > >