I'm trying to get a TimerTask setup so I can have a regularly occurring task fire every X days. Problem is I can't get the task to fire at all. The action fires.. thats great.. but when the time comes for the TimerTask to fire, nothing happens. I have started the TimerTask via a url Action call (inside the execute) and I have also started the task via the init in the Action. Neither seem to fire. Has anyone done this before and what might I change in order to get this to work.
Without seeing your code, it would be hard for anyone to help you.
Side note: If you're using a Servelet 2.3 or higher container, you might want to take the timer code out of the servlet/action and put it in a plain old java object; which you can instanciate and initialize with a context listener.
I am not sure, but you can try to place the time (Timer object) declared at class level variable, so that it will not be collection by GC after method is executed. Or you can set the timer object at application scope.
time.schedule(insertMonthlyRecordsTimedTask, java.util.Date x, long y); where x represents the date the task is fired off. where y represents number of milliseconds until the task is fired off again [repeated].
this DOES NOT work...
BUT when I use time.schedule(insertMonthlyRecordsTimedTask, long a, long b); where a represents number of milliseconds to wait until the first time the event is fired off. where b represents number of milliseconds until repeated.
this DOES work
Very odd. Any ideas?? [ March 24, 2006: Message edited by: Dale DeMott ]
Obviously the Timer itself is working. So that suggests that your inputs aren't what you think they are. For example if you provided "March 24, 2106, 11:30:00" as your starting date then you wouldn't see anything happening for quite a while.