Hi everybody
Is there any smart and as far as possible portable solution to have a timer service in a EJB container ( I am considering a possible solution to be implemented in an EJB container compliant to j2EE 1.3 ; I am looking forward to the J2EE 1.4 supporting timer services)
thanks a lot in advance for your help
claudio.
-
Timer service in the Ejb container (7 messages)
- Posted by: claudio marinelli
- Posted on: November 19 2003 04:30 EST
Threaded Messages (7)
- Timer service in the Ejb container by Paul Strack on November 19 2003 07:36 EST
- Timer service in the Ejb container by claudio marinelli on November 19 2003 10:03 EST
- Timer service in the Ejb container by Paul Strack on November 19 2003 11:46 EST
- Timer service in the Ejb container by claudio marinelli on November 19 2003 10:03 EST
- Timer in EJB 2.0 by Daoqi Yang on November 19 2003 11:16 EST
- Timer in EJB 2.0 by Stefano D'aluisio on February 03 2005 11:05 EST
- Timer service in the Ejb container by David Jones on November 19 2003 13:32 EST
- Timer service in the Ejb container by sougata Bhat on August 10 2004 06:23 EDT
-
Timer service in the Ejb container[ Go to top ]
- Posted by: Paul Strack
- Posted on: November 19 2003 07:36 EST
- in response to claudio marinelli
In J2EE 1.3, the best way to manage timer services is outside the EJB container. For example, you could start a timer thread in the init() method of a servlet with load-on-startup="true", and put this servlet in the same EAR as your EJBs.
If you really want the service to run inside the EJB container, I suggest you launch it from a Message-Driven Bean, and invoke this bean as part of startup process for your server. -
Timer service in the Ejb container[ Go to top ]
- Posted by: claudio marinelli
- Posted on: November 19 2003 10:03 EST
- in response to Paul Strack
In J2EE 1.3, the best way to manage timer services is outside the EJB container. For example, you could start a timer thread in the init() method of a servlet with load-on-startup="true", and put this servlet in the same EAR as your EJBs.
>
> If you really want the service to run inside the EJB container, I suggest you launch it from a Message-Driven Bean, and invoke this bean as part of startup process for your server.
Paul thanks very much for your answer
I well understand the first approach in the servlet context but I am a bit confused on the second approach you are suggesting for the ejb container
The question is --> which message (and who is the agent triggering this message)
wake up the message driven bean? ( you are referring to a sturtup process but is it a portable approach?) -
Timer service in the Ejb container[ Go to top ]
- Posted by: Paul Strack
- Posted on: November 19 2003 11:46 EST
- in response to claudio marinelli
I well understand the first approach in the servlet context but I am a bit
> confused on the second approach you are suggesting for the ejb container
> The question is --> which message (and who is the agent triggering this message)
> wake up the message driven bean? ( you are referring to a sturtup process but
> is it a portable approach?)
The server startup scripter will have to invoke the message bean. Alternately, you can write a separate process that invokes the message bean every time you restart the server. The message bean will be portable, but the startup script will not be. The startup script should be very simple, though.
I would go with the servlet-based approach myself, since it is 100% portable. -
Timer in EJB 2.0[ Go to top ]
- Posted by: Daoqi Yang
- Posted on: November 19 2003 11:16 EST
- in response to claudio marinelli
You could use the timer server in JMX, which is provided
in many app servers such as WebLogic.
I have used theses classes:
import weblogic.management.timer.Timer;
import javax.management.NotificationListener;
import javax.management.Notification;
import javax.management.InstanceNotFoundException;
You could download the standard JMX and load it into your EJB container.
Daoqi Yang -
Timer in EJB 2.0[ Go to top ]
- Posted by: Stefano D'aluisio
- Posted on: February 03 2005 11:05 EST
- in response to Daoqi Yang
Hi , i'm must use a Timer service (as you suggested)
to check new mail on a pop3 folder and save some information on DB.
To save on DB i call a ejb session stateless ; but doesn't work.
Do you know why ??? Weblogic tell to me : "i can't find the name of your EJB".... -
Timer service in the Ejb container[ Go to top ]
- Posted by: David Jones
- Posted on: November 19 2003 13:32 EST
- in response to claudio marinelli
One of the big design issues with a timer service in J2EE is getting it to work when you run multiple application servers in production. Sure there is no issue if wish the job the service is kicking off to run on every application server (JMX timer works well) but it does get more complex if you wish the job you are kicking off only to run once and handle failover if the application server fails.
For these jobs we wrote an external timer application java application that will kick of the job at the defined time. It will detect failure and will retry the job on a different a application server if failure is detected.
David -
Timer service in the Ejb container[ Go to top ]
- Posted by: sougata Bhat
- Posted on: August 10 2004 06:23 EDT
- in response to David Jones
I want to create a schedular.Say I will say my schedular after 1 hour it has to do job no1 and say after 2 hours it has to do job 2.And at the same time i want to persist that schedules so that if server goes down it should not loose my schedules.I am using weblogic 8.1.Can anyone help me
Thanks
Sougata