java.lang.Object
dev.mccue.guava.concurrent.Service.Listener
- Enclosing interface:
- Service
A listener for the various state changes that a
Service goes through in its lifecycle.
All methods are no-ops by default, implementors should override the ones they care about.
- Since:
- 15.0 (present as an interface in 13.0)
- Author:
- Luke Sandberg
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidfailed(Service.State from, Throwable failure) Called when the service transitions to theState#FAILED FAILEDstate.voidrunning()Called when the service transitions fromState#STARTING STARTINGtoState#RUNNING RUNNING.voidstarting()Called when the service transitions fromState#NEW NEWtoState#STARTING STARTING.voidstopping(Service.State from) Called when the service transitions to theState#STOPPING STOPPINGstate.voidterminated(Service.State from) Called when the service transitions to theState#TERMINATED TERMINATEDstate.
-
Constructor Details
-
Listener
public Listener()
-
-
Method Details
-
starting
public void starting()Called when the service transitions fromState#NEW NEWtoState#STARTING STARTING. This occurs whenService#startAsyncis called the first time. -
running
public void running()Called when the service transitions fromState#STARTING STARTINGtoState#RUNNING RUNNING. This occurs when a service has successfully started. -
stopping
Called when the service transitions to theState#STOPPING STOPPINGstate. The only valid values forfromareState#STARTING STARTINGorState#RUNNING RUNNING. This occurs whenService#stopAsyncis called.- Parameters:
from- The previous state that is being transitioned from.
-
terminated
Called when the service transitions to theState#TERMINATED TERMINATEDstate. TheState#TERMINATED TERMINATEDstate is a terminal state in the transition diagram. Therefore, if this method is called, no other methods will be called on theListener.- Parameters:
from- The previous state that is being transitioned from. Failure can occur in any state with the exception ofState#FAILED FAILEDandState#TERMINATED TERMINATED.
-
failed
Called when the service transitions to theState#FAILED FAILEDstate. TheState#FAILED FAILEDstate is a terminal state in the transition diagram. Therefore, if this method is called, no other methods will be called on theListener.- Parameters:
from- The previous state that is being transitioned from. Failure can occur in any state with the exception ofState#NEW NEWorState#TERMINATED TERMINATED.failure- The exception that caused the failure.
-