Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » timerTask query
timerTask query [message #901590] Mon, 13 August 2012 10:52
alexandra123 l is currently offline alexandra123 l
Messages: 4
Registered: August 2012
Junior Member
Hello,


I am looking for some guidance here.

I have created a timerTask that will run once every 10 minutes. This timerTask prints out a line every 10 minutes to the console.

I now need to consider - crashes, server stopping and restarting etc.

How would I go about making sure that the process is kicked off everytime the server is started and that it can recover from any state ? I am using Eclipse with a Dynamic Web Project.


public Initialize(int seconds){
	
		Timer timer = new Timer();
		
		timer.schedule(new timerTask(), 0, 1*600000);
	
	}
	
	
	class timerTask extends TimerTask{		
		public void run(){
			 Date date = new Date();
			 try{
			
			System.out.println(date);
			
			 }catch (Exception e) {
				 System.exit(0);
			}
		}
			

Thanks in advance



Previous Topic:ObjectName to read Tomcat configuration
Next Topic:parse part of string
Goto Forum:
  


Current Time: Sat Aug 23 07:40:16 EDT 2014

Powered by FUDForum. Page generated in 0.01560 seconds