public abstract class SignalAwaitingService extends InterruptingScheduledService
InterruptingScheduledService.runOneIteration(). This can be used to have the Service fully enter the RUNNING state
and schedule it's periodic task, but block the actual execution of the task until some condition
is met by another thread.
Implementation note: await() is called in the thread running the "periodic task" as it is easier to interrupt that thread when the Service is shut down; blocking on the latch in the startUp() method caused the Service to never exit (and prevent the JVM from exiting normally on SIGINT).
| Constructor and Description |
|---|
SignalAwaitingService(CountDownLatch signal) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
beforeIteration()
A hook for subclasses to insert extra steps before
InterruptingScheduledService.runOneIteration(). |
runOneIteration, schedule, shutDown, startUppublic SignalAwaitingService(CountDownLatch signal)
protected void beforeIteration()
throws InterruptedException
InterruptingScheduledServiceInterruptingScheduledService.runOneIteration().beforeIteration in class InterruptingScheduledServiceInterruptedExceptionCopyright © 2017. All rights reserved.