final ScheduledExecutorService newScheduledThreadPool = Executors.newScheduledThreadPool(1);
newScheduledThreadPool.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
boolean isExecutionDone = false;
try {
isExecutionDone = checkIfExecutionIsDone();
} finally {
if (isExecutionDone) {
newScheduledThreadPool.shutdown();
}
}
}
}, 1, 1, TimeUnit.SECONDS);
czwartek, 8 października 2015
How to make active waiting in separate thread
Subskrybuj:
Komentarze do posta (Atom)
Brak komentarzy:
Prześlij komentarz