| Constructor and Description |
|---|
ManagedChannel() |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
awaitTermination(long timeout,
TimeUnit unit)
Waits for the channel to become terminated, giving up if the timeout is reached.
|
ConnectivityState |
getState(boolean requestConnection)
Gets the current connectivity state.
|
abstract boolean |
isShutdown()
Returns whether the channel is shutdown.
|
abstract boolean |
isTerminated()
Returns whether the channel is terminated.
|
void |
notifyWhenStateChanged(ConnectivityState source,
Runnable callback)
Registers a one-off callback that will be run if the connectivity state of the channel diverges
from the given
source, which is typically what has just been returned by getState(boolean). |
abstract ManagedChannel |
shutdown()
Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately
cancelled.
|
abstract ManagedChannel |
shutdownNow()
Initiates a forceful shutdown in which preexisting and new calls are cancelled.
|
public abstract ManagedChannel shutdown()
public abstract boolean isShutdown()
shutdown(),
isTerminated()public abstract boolean isTerminated()
isShutdown()public abstract ManagedChannel shutdownNow()
isTerminated() will likely
return false immediately after this method returns.public abstract boolean awaitTermination(long timeout,
TimeUnit unit)
throws InterruptedException
isTerminated().InterruptedException@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/28") public ConnectivityState getState(boolean requestConnection)
requestConnection - if true, the channel will try to make a connection if it is
currently IDLEUnsupportedOperationException - if not supported by implementation@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/28") public void notifyWhenStateChanged(ConnectivityState source, Runnable callback)
source, which is typically what has just been returned by getState(boolean). If the states are already different, the callback will be called immediately. The
callback is run in the same executor that runs Call listeners.source - the assumed current state, typically just returned by getState(boolean)callback - the one-off callbackUnsupportedOperationException - if not supported by implementation