Recurring schedule say daily at 10:00 P:M Using Timer and TimerTask
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Java_Dev
Posted On:   Monday, April 18, 2005 03:23 PM

I have a singleton object which creates static Timer Object and calls one of the scheduleAtFixedRate method (timerTask,x,y) where x is calendar object with 10:00 A:M value and y value is 1000 * 60 * 60 * 24 * 7. timerTask object has biz. logic in its run method Trying to execute in Weblogic 8.1 with only EJB(s) -- Stateless EJB. Stateless EJB - ejbCreate method, I call getInstace method of my singleton object which also schedules timer task by creating timer object (i.e. static reference) as well. It seems like it only calls once and does not calling again on next day .. So, when i start the server -- it executes the timer task say at 10:00 A:M -- Next day again   More>>

I have a singleton object which creates
static Timer Object
and calls one of the scheduleAtFixedRate method
(timerTask,x,y) where x is calendar object with 10:00 A:M value and y value is 1000 * 60 * 60 * 24 * 7.

timerTask object has biz. logic in its run method

Trying to execute in Weblogic 8.1 with only EJB(s) -- Stateless EJB.

Stateless EJB - ejbCreate method,
I call getInstace method of my singleton object which also schedules timer task by creating timer object (i.e. static reference) as well.

It seems like it only calls once and does not calling again on next day ..

So, when i start the server -- it executes the timer task say at 10:00 A:M --
Next day again it should execute at 10:00 A:M which its not.

anybody please help if knows the issue.

   <<Less

Re: Recurring schedule say daily at 10:00 P:M Using Timer and TimerTask

Posted By:   Java_Dev  
Posted On:   Monday, April 18, 2005 03:44 PM

the code for doing this:

//singleton implmtn...

private static timer = null;

....

public getInstance() {

.....
}

private scheduleJob() {
Calendar date = Calendar.getInstance();

date.set(Calendar.HOUR, 10);
date.set(Calendar.MINUTE,00));
date.set(Calendar.SECOND, 0);
date.set(Calendar.MILLISECOND, 0);

timer = new Timer();
//For daily
timer.scheduleAtFixedRate(new Task(),
date.getTime(),1000 * 60 * 60 * 24 * 7);
}

Task is for TimerTask ------

It only executes once and looks like not recurring again on next day -----

has anybody has it working --
About | Sitemap | Contact