C
crash.test.dummy
i have a scheduled task that runs every 5 mins, if everything went ok.
if the last execution of this scheduled task returned false, the delay
should be 10 mins.
how do i do this?
here's a code sample (using 5-minute [fixed-rate] delays):
java.util.Timer myTimer = new java.util.Timer();
myTimer.schedule(new MyRunner(), 0, 300000);
....
static class MyRunner extends TimerTask {
public void run() {
FileOpenTask myTask= new FileOpenTask();
myTask.openFile("myFile.txt");
}
}
.....
public class FileOpenTask {
// the returned value of this method is, at this point, useless to
the caller
public boolean openFile(String filename) {
try {
FileInputStream fstream = new FileInputStream(filename);
} catch (FileNotFoundException fnfe) {
return false;
}
return true;
}
}
if the last execution of this scheduled task returned false, the delay
should be 10 mins.
how do i do this?
here's a code sample (using 5-minute [fixed-rate] delays):
java.util.Timer myTimer = new java.util.Timer();
myTimer.schedule(new MyRunner(), 0, 300000);
....
static class MyRunner extends TimerTask {
public void run() {
FileOpenTask myTask= new FileOpenTask();
myTask.openFile("myFile.txt");
}
}
.....
public class FileOpenTask {
// the returned value of this method is, at this point, useless to
the caller
public boolean openFile(String filename) {
try {
FileInputStream fstream = new FileInputStream(filename);
} catch (FileNotFoundException fnfe) {
return false;
}
return true;
}
}