Package io.grpc.internal
Class ConnectivityStateManager
java.lang.Object
io.grpc.internal.ConnectivityStateManager
Manages connectivity states of the channel. Used for
ManagedChannel.getState(boolean) to read the
current state of the channel, for ManagedChannel.notifyWhenStateChanged(io.grpc.ConnectivityState, java.lang.Runnable) to add
listeners to state change events, and for LoadBalancer.Helper#updateBalancingState to update the state and run the gotoState(io.grpc.ConnectivityState)s.-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) ConnectivityStategetState()Gets the current connectivity state of the channel.(package private) voidgotoState(ConnectivityState newState) Connectivity state is changed to the specified value.(package private) voidnotifyWhenStateChanged(Runnable callback, Executor executor, ConnectivityState source) Adds a listener for state change event.
-
Field Details
-
listeners
-
state
-
-
Constructor Details
-
ConnectivityStateManager
ConnectivityStateManager()
-
-
Method Details
-
notifyWhenStateChanged
Adds a listener for state change event.The
executormust be one that can run RPC call listeners. -
gotoState
Connectivity state is changed to the specified value. Will trigger some notifications that have been registered earlier byManagedChannel.notifyWhenStateChanged(io.grpc.ConnectivityState, java.lang.Runnable). -
getState
ConnectivityState getState()Gets the current connectivity state of the channel. This method is threadsafe.
-