Re: timed events
Get Sims Computing Inc product called Flux. You will need to set the times via a servlet or application, but it provides the timer or clock that your're writing about. http://www.simscomputing.com/ On Wednesday 13 March 2002 08:06 am, you wrote: 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 .
Re: timed events
One solution would be to write a client-application which contains a timer and timertasks. The client could for example send a JMS message to a MDB which triggers an event. The client could be autostarted together with your application (most app-servers has a way of doing this). In this way you follow the standard, it is scalable, distributable and formost it is not that hard to to. /Linus On Thursday, March 14, 2002, at 12:29 AM, Tim Endres wrote: There are several solutions out there, both commercial and open source. You might wish to take a look before reinventing. tim. Which is not that portable across Application Servers ;) Typical issues are JNDI lookup problems up to ClassCastExceptions. Jens | -Original Message- | From: [EMAIL PROTECTED] | [mailto:[EMAIL PROTECTED]]On Behalf Of | [EMAIL PROTECTED] | Sent: Wednesday, March 13, 2002 5:21 PM | To: Orion-Interest | Subject: RE: timed events | | | Hi, | | I use a java.util.Timer wrapped my Scheduler class to schedule | tasks. I bind | an instance of this Scheduler to the JNDI from one of my servlet's init() | method. | | It works fine, use -userThreads switch to start orion if you want context | lookup from the scheduled threads. | | HTH, | | Tibor | | -Original Message- | From: daniele rizzi [mailto:[EMAIL PROTECTED]] | Sent: Wednesday, March 13, 2002 2:25 PM | To: Orion-Interest | Subject: R: timed events | | | | Hi Casper, | | EJB are not multithreaded but a normal class *is*. | | Try putting the stuff in a public class TryMe extends Thread{} | | d. | | ps. if you need a scheduler the things are tougher. | | | | -Messaggio originale- | Da: [EMAIL PROTECTED] | [mailto:[EMAIL PROTECTED]]Per conto di Casper | H¯jstrup | Inviato: mercoledÏ 13 marzo 2002 10.21 | A: Orion-Interest | Oggetto: 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 | . |
RE: timed events
Just one hint: Set the classloader before calling start() for your thread to the classloader of the servlet and you will not have issues on several other commercial platforms. Jens | -Original Message- | From: [EMAIL PROTECTED] | [mailto:[EMAIL PROTECTED]]On Behalf Of | [EMAIL PROTECTED] | Sent: Thursday, March 14, 2002 7:49 AM | To: Orion-Interest | Subject: RE: timed events | | | Jens, | | Unfortunately, you're correct :-(. It is not portable for exactly what you | have written (Context issues), but for Orion it is pretty simple and | straightforward. | | Tibor | | -Original Message- | From: Jens Schumann [mailto:[EMAIL PROTECTED]] | Sent: Wednesday, March 13, 2002 11:15 PM | To: Orion-Interest | Subject: RE: timed events | | | Which is not that portable across Application Servers ;) | Typical issues are JNDI lookup problems up to ClassCastExceptions. | | Jens | | | -Original Message- | | From: [EMAIL PROTECTED] | | [mailto:[EMAIL PROTECTED]]On Behalf Of | | [EMAIL PROTECTED] | | Sent: Wednesday, March 13, 2002 5:21 PM | | To: Orion-Interest | | Subject: RE: timed events | | | | | | Hi, | | | | I use a java.util.Timer wrapped my Scheduler class to schedule | | tasks. I bind | | an instance of this Scheduler to the JNDI from one of my | servlet's init() | | method. | | | | It works fine, use -userThreads switch to start orion if you | want context | | lookup from the scheduled threads. | | | | HTH, | | | | Tibor | | | | -Original Message- | | From: daniele rizzi [mailto:[EMAIL PROTECTED]] | | Sent: Wednesday, March 13, 2002 2:25 PM | | To: Orion-Interest | | Subject: R: timed events | | | | | | | | Hi Casper, | | | | EJB are not multithreaded but a normal class *is*. | | | | Try putting the stuff in a public class TryMe extends Thread{} | | | | d. | | | | ps. if you need a scheduler the things are tougher. | | | | | | | | -Messaggio originale- | | Da: [EMAIL PROTECTED] | | [mailto:[EMAIL PROTECTED]]Per conto di Casper | | Højstrup | | Inviato: mercoledì 13 marzo 2002 10.21 | | A: Orion-Interest | | Oggetto: 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 | | . | | |
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 .
RE: timed events
Hi, I use a java.util.Timer wrapped my Scheduler class to schedule tasks. I bind an instance of this Scheduler to the JNDI from one of my servlet's init() method. It works fine, use -userThreads switch to start orion if you want context lookup from the scheduled threads. HTH, Tibor -Original Message- From: daniele rizzi [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 13, 2002 2:25 PM To: Orion-Interest Subject: R: timed events Hi Casper, EJB are not multithreaded but a normal class *is*. Try putting the stuff in a public class TryMe extends Thread{} d. ps. if you need a scheduler the things are tougher. -Messaggio originale- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]Per conto di Casper Højstrup Inviato: mercoledì 13 marzo 2002 10.21 A: Orion-Interest Oggetto: 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 .
RE: timed events
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 .
RE: timed events
Which is not that portable across Application Servers ;) Typical issues are JNDI lookup problems up to ClassCastExceptions. Jens | -Original Message- | From: [EMAIL PROTECTED] | [mailto:[EMAIL PROTECTED]]On Behalf Of | [EMAIL PROTECTED] | Sent: Wednesday, March 13, 2002 5:21 PM | To: Orion-Interest | Subject: RE: timed events | | | Hi, | | I use a java.util.Timer wrapped my Scheduler class to schedule | tasks. I bind | an instance of this Scheduler to the JNDI from one of my servlet's init() | method. | | It works fine, use -userThreads switch to start orion if you want context | lookup from the scheduled threads. | | HTH, | | Tibor | | -Original Message- | From: daniele rizzi [mailto:[EMAIL PROTECTED]] | Sent: Wednesday, March 13, 2002 2:25 PM | To: Orion-Interest | Subject: R: timed events | | | | Hi Casper, | | EJB are not multithreaded but a normal class *is*. | | Try putting the stuff in a public class TryMe extends Thread{} | | d. | | ps. if you need a scheduler the things are tougher. | | | | -Messaggio originale- | Da: [EMAIL PROTECTED] | [mailto:[EMAIL PROTECTED]]Per conto di Casper | Højstrup | Inviato: mercoledì 13 marzo 2002 10.21 | A: Orion-Interest | Oggetto: 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 | . |
RE: timed events
There are several solutions out there, both commercial and open source. You might wish to take a look before reinventing. tim. Which is not that portable across Application Servers ;) Typical issues are JNDI lookup problems up to ClassCastExceptions. Jens | -Original Message- | From: [EMAIL PROTECTED] | [mailto:[EMAIL PROTECTED]]On Behalf Of | [EMAIL PROTECTED] | Sent: Wednesday, March 13, 2002 5:21 PM | To: Orion-Interest | Subject: RE: timed events | | | Hi, | | I use a java.util.Timer wrapped my Scheduler class to schedule | tasks. I bind | an instance of this Scheduler to the JNDI from one of my servlet's init() | method. | | It works fine, use -userThreads switch to start orion if you want context | lookup from the scheduled threads. | | HTH, | | Tibor | | -Original Message- | From: daniele rizzi [mailto:[EMAIL PROTECTED]] | Sent: Wednesday, March 13, 2002 2:25 PM | To: Orion-Interest | Subject: R: timed events | | | | Hi Casper, | | EJB are not multithreaded but a normal class *is*. | | Try putting the stuff in a public class TryMe extends Thread{} | | d. | | ps. if you need a scheduler the things are tougher. | | | | -Messaggio originale- | Da: [EMAIL PROTECTED] | [mailto:[EMAIL PROTECTED]]Per conto di Casper | Højstrup | Inviato: mercoledì 13 marzo 2002 10.21 | A: Orion-Interest | Oggetto: 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 | . |
RE: timed events
Jens, Unfortunately, you're correct :-(. It is not portable for exactly what you have written (Context issues), but for Orion it is pretty simple and straightforward. Tibor -Original Message- From: Jens Schumann [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 13, 2002 11:15 PM To: Orion-Interest Subject: RE: timed events Which is not that portable across Application Servers ;) Typical issues are JNDI lookup problems up to ClassCastExceptions. Jens | -Original Message- | From: [EMAIL PROTECTED] | [mailto:[EMAIL PROTECTED]]On Behalf Of | [EMAIL PROTECTED] | Sent: Wednesday, March 13, 2002 5:21 PM | To: Orion-Interest | Subject: RE: timed events | | | Hi, | | I use a java.util.Timer wrapped my Scheduler class to schedule | tasks. I bind | an instance of this Scheduler to the JNDI from one of my servlet's init() | method. | | It works fine, use -userThreads switch to start orion if you want context | lookup from the scheduled threads. | | HTH, | | Tibor | | -Original Message- | From: daniele rizzi [mailto:[EMAIL PROTECTED]] | Sent: Wednesday, March 13, 2002 2:25 PM | To: Orion-Interest | Subject: R: timed events | | | | Hi Casper, | | EJB are not multithreaded but a normal class *is*. | | Try putting the stuff in a public class TryMe extends Thread{} | | d. | | ps. if you need a scheduler the things are tougher. | | | | -Messaggio originale- | Da: [EMAIL PROTECTED] | [mailto:[EMAIL PROTECTED]]Per conto di Casper | Højstrup | Inviato: mercoledì 13 marzo 2002 10.21 | A: Orion-Interest | Oggetto: 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 | . |