hi, my requirement is to run some task once in every month.i am getting this information from xml file exa first saturday of every month so i am setting this using gregorian calender. but problem is it is running the task only when i deploy my application.so anybody help me.
hi, thanks for reply. i am using the below code. for this requirement. Adding TimerShecdulerContextListener class as a listener in web.xml BackupTimer is my task. the below code is working fine only at the time of deployment.But my requirement is if the server is running(with required war in deploy folder of server) the task has to execute for the given time without doing redeployment.
The schedule call you use only schedules the task to run a single time, not repeatedly; that's what some of the other Timer.schedule(atFixedRate) methods are for.
The difficulty here is that the interval between executions is not fixed, since the number of days between first Saturdays varies. You can either schedule the next run at the end of the current run, or schedule the task to run every day, and then check within the task whether it is the first Saturday of a month (and otherwise do nothing).
(Added later: Just saw Sagar's post, but I'm not sure what he's getting at.) [ January 03, 2009: Message edited by: Ulf Dittmer ]