/**
* Schedule two tasks. The first task throws an exception. Verify that
* the second task is run.
*/
public void run() throws Exception {
WakeupManager manager = new WakeupManager();
long badTaskTime = System.currentTimeMillis() + (10*1000);
long goodTaskTime = badTaskTime + (10*1000);
manager.schedule(badTaskTime, new Runnable() {
public void run() {
throw new RuntimeException("Expected Exception");
}
});
final boolean result[] = new boolean[]{false};
manager.schedule(goodTaskTime, new Runnable() {
public void run() {
result[0] = true;
}
});
while (System.currentTimeMillis() < goodTaskTime + 10) {