Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » timerTask query
timerTask query [message #901590] Mon, 13 August 2012 14:52
alexandra123 l is currently offline alexandra123 lFriend
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: Thu Apr 25 09:21:46 GMT 2024

Powered by FUDForum. Page generated in 0.07935 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top