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);
Brak komentarzy:
Prześlij komentarz