[jboss-user] [Beginners Corner] - TimedObject question.
UBorba
do-not-reply at jboss.com
Fri Aug 25 15:20:02 EDT 2006
Hi,
I wrote a class:
| public class PnaScheduleFacade implements SessionBean, TimedObject {
| public void ejbTimeout(Timer arg0) {
| // task code.
| }
|
| public TimerHandle createTimerHandle(long interval) {
| TimerService timerService = context.getTimerService();
| Timer timer = timerService.createTimer(interval, interval, null);
| return timer.getHandle();
| }
|
| }
|
and another class to start the service:
| public class PnaScheduler implements Schedulable {
|
| public void perform(Date arg0, long arg1) {
| if(!started) {
| PnaScheduleFacadeLocal psLocal = EJBUtil.findLocalObject(PnaScheduleFacadeLocal.class);
| TimerHandle handle = psLocal.createTimerHandle(interval);
| System.out.println("Handle = " + handle);
| started = true;
| }
| }
|
| }
|
The schedule does it fine, but every time I restart my JBoss it will create
another Timer, and JBoss will also restart old Timers that are serialized, I need to check in code if there is already a Timer that restarts the service and create another one only if necessary.
Thanks for any help/directions.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3967561#3967561
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3967561
More information about the jboss-user
mailing list