Package com.google.api.core
Class ApiService.Listener
- java.lang.Object
-
- com.google.api.core.ApiService.Listener
-
- Enclosing interface:
- ApiService
@BetaApi public abstract static class ApiService.Listener extends Object
A listener for the various state changes that aApiServicegoes through in its lifecycle.All methods are no-ops by default, implementors should override the ones they care about.
-
-
Constructor Summary
Constructors Constructor Description Listener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfailed(ApiService.State from, Throwable failure)Called when the service transitions to the FAILED state.voidrunning()voidstarting()voidstopping(ApiService.State from)Called when the service transitions to the STOPPING state.voidterminated(ApiService.State from)Called when the service transitions to the TERMINATED state.
-
-
-
Method Detail
-
failed
public void failed(ApiService.State from, Throwable failure)
Called when the service transitions to the FAILED state. The FAILED state is a terminal state in the transition diagram. Therefore, if this method is called, no other methods will be called on theApiService.Listener.- Parameters:
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.
-
running
public void running()
-
starting
public void starting()
Called when the service transitions from NEW to STARTING. This occurs whenApiService.startAsync()is called the first time.
-
stopping
public void stopping(ApiService.State from)
Called when the service transitions to the STOPPING state. The only valid values forfromare STARTING or RUNNING. This occurs whenApiService.stopAsync()is called.- Parameters:
from- The previous state that is being transitioned from.
-
terminated
public void terminated(ApiService.State from)
Called when the service transitions to the TERMINATED state. The TERMINATED state is a terminal state in the transition diagram. Therefore, if this method is called, no other methods will be called on theApiService.Listener.
-
-