When exception occurs in timer event, timer stops How to resume after exception ?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   mahesh_chavan
Posted On:   Sunday, September 24, 2006 05:32 PM

I am using timer to check and download a webpage every 3 seconds. However in case any exception occurs, then timer stops. final java.util.Timer timer = new java.util.Timer(); timer.scheduleAtFixedRate(new java.util.TimerTask() { public void run() { GetPost();}}, 1000, 3000); . . . public void GetPost() { String line = ""; StringBuffer s1 = new StringBuffer(" "); i = (totPoints * 4)+ (polyLineNo * 10) + 4; txtmsg = ""; Date curTime = new Date(); lblTool.setText(htmurl + " Updated : " + curTime); try { yc2 = htmurl.openConnection(); lastMod2 = yc2.getLastModified(); } catch (I   More>>

I am using timer to check and download a webpage every 3 seconds. However in case any exception occurs, then timer stops.


final java.util.Timer timer = new java.util.Timer();
timer.scheduleAtFixedRate(new java.util.TimerTask() {
public void run() { GetPost();}}, 1000, 3000);


.


.


.


public void GetPost() {


String line = "";


StringBuffer s1 = new StringBuffer(" ");


i = (totPoints * 4)+ (polyLineNo * 10) + 4;


txtmsg = "";


Date curTime = new Date();


lblTool.setText(htmurl + " Updated : " + curTime);


try {


yc2 = htmurl.openConnection();


lastMod2 = yc2.getLastModified();


} catch (IOException ioe) {


keymsg = "get post ******* ERROR " + ioe.getMessage();


}



How to resume after exception has occured ?

   <<Less
About | Sitemap | Contact