@BetaApi public abstract static class ApiService.Listener extends Object
ApiService
goes through in its
lifecycle.
All methods are no-ops by default, implementors should override the ones they care about.
Constructor and Description |
---|
Listener() |
Modifier and Type | Method and Description |
---|---|
void |
failed(ApiService.State from,
Throwable failure)
Called when the service transitions to the FAILED state.
|
void |
running()
|
void |
starting()
|
void |
stopping(ApiService.State from)
Called when the service transitions to the STOPPING state.
|
void |
terminated(ApiService.State from)
Called when the service transitions to the TERMINATED state.
|
public void failed(ApiService.State from, Throwable failure)
ApiService.Listener
.from
- The previous state that is being transitioned from. Failure can occur in any
state with the exception of NEW or TERMINATED.failure
- The exception that caused the failure.public void running()
public void starting()
ApiService.startAsync()
is
called the first time.public void stopping(ApiService.State from)
from
are STARTING or
RUNNING. This occurs when ApiService.stopAsync()
is called.from
- The previous state that is being transitioned from.public void terminated(ApiService.State from)
ApiService.Listener
.