handle

Hi, I have written a program to periodly check a web site to read some information periodly (use Timer). The code is something likethis:

try{

URL url =new URL("http://www.cnn.com");

BufferedReader in =new BufferedReader(new InputStreamReader(url.openStream()));

String str;

while ((str = in.readLine()) !=null){

//process str.....

//if wanted info is read, process it and return

return;

}

}

}catch (MalformedURLException e){

e.printStackTrace();

}catch (IOException e){

e.printStackTrace();

}

publicvoid monitor(){

Timer timer =new Timer();

timer.schedule(new RemindTask(), 0, interval*1000);

}

class RemindTaskextends TimerTask{

publicvoid run(){

readHTML();

}

}

The problem is: when the"connection timed out" exception happens, the program stopped continually to give result at next desired time (after 10min) but did not quit either...

Can you tell me what happended there and how should I correct the code?

Thanksfor the attention..

Mike

[2273 byte] By [happyhelpera] at [2007-10-2 2:23:30]
# 1
Sorry, the original subject is messed up..
happyhelpera at 2007-7-15 20:14:58 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...