@Beta public abstract static class Service.Listener extends Object
Service
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(Service.State from,
Throwable failure)
Called when the service transitions to the FAILED state.
|
void |
running()
|
void |
starting()
|
void |
stopping(Service.State from)
Called when the service transitions to the STOPPING state.
|
void |
terminated(Service.State from)
Called when the service transitions to the TERMINATED state.
|
public Listener()
public void starting()
Service.startAsync()
is called the first
time.public void running()
public void stopping(Service.State from)
from
are STARTING or RUNNING. This occurs when Service.stopAsync()
is called.from
- The previous state that is being transitioned from.public void terminated(Service.State from)
Service.Listener
.public void failed(Service.State from, Throwable failure)
Service.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.Copyright © 2010–2018. All rights reserved.