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
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to