private final class AbstractScheduledService.ServiceDelegate extends AbstractService
| Modifier and Type | Class and Description |
|---|---|
(package private) class |
AbstractScheduledService.ServiceDelegate.Task |
Service.Listener, Service.State| Modifier and Type | Field and Description |
|---|---|
private java.util.concurrent.ScheduledExecutorService |
executorService |
private java.util.concurrent.locks.ReentrantLock |
lock |
private java.util.concurrent.Future<?> |
runningTask |
private java.lang.Runnable |
task |
| Modifier | Constructor and Description |
|---|---|
private |
ServiceDelegate() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doStart()
This method is called by
AbstractService.startAsync() to initiate service startup. |
protected void |
doStop()
This method should be used to initiate service shutdown.
|
java.lang.String |
toString() |
addListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, failureCause, isRunning, notifyFailed, notifyStarted, notifyStopped, startAsync, state, stopAsyncprivate volatile java.util.concurrent.Future<?> runningTask
private volatile java.util.concurrent.ScheduledExecutorService executorService
private final java.util.concurrent.locks.ReentrantLock lock
private final java.lang.Runnable task
protected final void doStart()
AbstractServiceAbstractService.startAsync() to initiate service startup. The invocation of
this method should cause a call to AbstractService.notifyStarted(), either during this method's run,
or after it has returned. If startup fails, the invocation should cause a call to AbstractService.notifyFailed(Throwable) instead.
This method should return promptly; prefer to do work on a different thread where it is
convenient. It is invoked exactly once on service startup, even when AbstractService.startAsync() is
called multiple times.
doStart in class AbstractServiceprotected final void doStop()
AbstractServiceAbstractService.notifyStopped(), either during this method's run, or after it has
returned. If shutdown fails, the invocation should cause a call to AbstractService.notifyFailed(Throwable) instead.
This method should return promptly; prefer to do work on a different thread where it is
convenient. It is invoked exactly once on service shutdown, even when AbstractService.stopAsync() is
called multiple times.
doStop in class AbstractServicepublic java.lang.String toString()
toString in class AbstractService