Skip to content

Instantly share code, notes, and snippets.

@sherman
Created February 2, 2012 14:30
Show Gist options
  • Save sherman/1723719 to your computer and use it in GitHub Desktop.
Save sherman/1723719 to your computer and use it in GitHub Desktop.
resultCheckerExecutor.execute(
new Runnable() {
@Override
public void run() {
while (true) {
try {
Task saved = taskDao.getById(task.getId());
assertNotNull(saved);
if (saved.getState().equals(TaskState.ERROR)) {
assertNull(saved.getFinished());
assertNotNull(saved.getStarted());
resultSemaphore.release();
break;
}
try {
Thread.sleep(PAUSE_TIME);
} catch (InterruptedException e) {}
} catch (Exception e) {
log.error("Error in result checker", e);
}
}
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment