startUp and shutDown methods, each which
run in an executor which by default uses a separate thread for each method.
| Modifier and Type | Class and Description |
|---|---|
| private class | |
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private final Service | |
| private final Supplier |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public final void | addListener(Service.
the listener to run when the service changes state is complete listener,the executor in which the listeners callback methods will be run. For fast,
lightweight listeners that would be safe to execute in any thread, consider executor)MoreExecutors#directExecutor.Implements com. Listener to be executed on the given
executor.
|
| public final void | awaitRunning()
Implements com. Service to reach the running state.
|
| public final void | awaitRunning(Duration
the maximum time to wait timeout)Overrides default com. Service to reach the running state for no more
than the given time.
|
| public final void | awaitRunning(long
the maximum time to wait timeout, TimeUnit the time unit of the timeout argument unit)Implements com. Service to reach the running state for no more
than the given time.
|
| public final void | awaitTerminated()
Implements com. Service to reach the terminated state.
|
| public final void | awaitTerminated(Duration
the maximum time to wait timeout)Overrides default com. Service to reach a terminal state (either terminated or failed) for no more than the given time.
|
| public final void | awaitTerminated(long
the maximum time to wait timeout, TimeUnit the time unit of the timeout argument unit)Implements com. Service to reach a terminal state (either terminated or failed) for no more than the given time.
|
| protected Executor | |
| public final Throwable | failureCause()
Implements com. Throwable that caused this service to fail.
|
| public final boolean | isRunning()
Implements com. true if this service is running.
|
| protected String | |
| protected abstract void | |
| public final Service | startAsync()
Implements com. State#NEW, this initiates service startup and returns
immediately.
|
| protected abstract void | |
| public final Service. | state()
Implements com. |
| public final Service | stopAsync()
Implements com. |
| public String |
| delegate | back to summary |
|---|---|
| private final Service delegate | |
| threadNameSupplier | back to summary |
|---|---|
| private final Supplier<String> threadNameSupplier | |
| AbstractIdleService | back to summary |
|---|---|
| protected AbstractIdleService() Constructor for use by subclasses. | |
| addListener | back to summary |
|---|---|
| public final void addListener(Service. Implements com. Doc from com. Registers a
RuntimeExceptions thrown by a listener will be caught and logged. Any exception thrown
during
| |
| awaitRunning | back to summary |
|---|---|
| public final void awaitRunning() Implements com. Doc from com. Waits for the
| |
| awaitRunning | back to summary |
|---|---|
| public final void awaitRunning(Duration timeout) throws TimeoutException Overrides default com. Doc from com. Waits for the
| |
| awaitRunning | back to summary |
|---|---|
| public final void awaitRunning(long timeout, TimeUnit unit) throws TimeoutException Implements com. Doc from com. Waits for the
| |
| awaitTerminated | back to summary |
|---|---|
| public final void awaitTerminated() Implements com. Doc from com. Waits for the
| |
| awaitTerminated | back to summary |
|---|---|
| public final void awaitTerminated(Duration timeout) throws TimeoutException Overrides default com. Doc from com. Waits for the
| |
| awaitTerminated | back to summary |
|---|---|
| public final void awaitTerminated(long timeout, TimeUnit unit) throws TimeoutException Implements com. Doc from com. Waits for the
| |
| executor | back to summary |
|---|---|
| protected Executor executor() Returns the | |
| failureCause | back to summary |
|---|---|
| public final Throwable failureCause() Implements com. Doc from com. Returns the
| |
| isRunning | back to summary |
|---|---|
| public final boolean isRunning() Implements com. Doc from com. Returns
| |
| serviceName | back to summary |
|---|---|
| protected String serviceName() Returns the name of this service.
| |
| shutDown | back to summary |
|---|---|
| protected abstract void shutDown() throws Exception Stop the service. | |
| startAsync | back to summary |
|---|---|
| public final Service startAsync() Implements com. Doc from com. If the service state is
| |
| startUp | back to summary |
|---|---|
| protected abstract void startUp() throws Exception Start the service. | |
| state | back to summary |
|---|---|
| public final Service. Implements com. Doc from com. Returns the lifecycle state of the service.
| |
| stopAsync | back to summary |
|---|---|
| public final Service stopAsync() Implements com. Doc from com. If the service is starting or running, this initiates service shutdown and returns immediately. If the service is new, it is terminated without having been started nor stopped. If the service has already been stopped, this method returns immediately without taking action.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| protected final void | doStart()
Implements abstract com. startAsync to initiate service startup.
|
| protected final void | doStop()
Implements abstract com. |
| public String | toString()
Overrides com. |
| DelegateService | back to summary |
|---|---|
| private DelegateService() | |
| doStart | back to summary |
|---|---|
| protected final void doStart() Implements abstract com. Doc from com. This method is called by 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
| |
| doStop | back to summary |
|---|---|
| protected final void doStop() Implements abstract com. Doc from com. This method should be used to initiate service shutdown. The invocation of this method should
cause a call to 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 If
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides com. Doc from java. Returns a string representation of the object. | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public String |
| ThreadNameSupplier | back to summary |
|---|---|
| private ThreadNameSupplier() | |
| get | back to summary |
|---|---|
| public String get() Implements com. Doc from com. Retrieves an instance of the appropriate type. The returned object may or may not be a new instance, depending on the implementation. | |