Class OobChannel
java.lang.Object
io.grpc.Channel
io.grpc.ManagedChannel
io.grpc.internal.OobChannel
- All Implemented Interfaces:
InternalInstrumented<InternalChannelz.ChannelStats>, InternalWithLogId
@ThreadSafe
final class OobChannel
extends ManagedChannel
implements InternalInstrumented<InternalChannelz.ChannelStats>
A ManagedChannel backed by a single
InternalSubchannel and used for LoadBalancer
to its own RPC needs.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final CallTracerprivate final ChannelTracerprivate final InternalChannelzprivate final ScheduledExecutorServiceprivate final DelayedClientTransportprivate final Executorprivate final ObjectPool<? extends Executor> private static final Loggerprivate final InternalLogIdprivate booleanprivate InternalSubchannelprivate AbstractSubchannelprivate LoadBalancer.SubchannelPickerprivate final CountDownLatchprivate final TimeProviderprivate final ClientCallImpl.ClientStreamProvider -
Constructor Summary
ConstructorsConstructorDescriptionOobChannel(String authority, ObjectPool<? extends Executor> executorPool, ScheduledExecutorService deadlineCancellationExecutor, SynchronizationContext syncContext, CallTracer callsTracer, ChannelTracer channelTracer, InternalChannelz channelz, TimeProvider timeProvider) -
Method Summary
Modifier and TypeMethodDescriptionThe authority of the destination this channel connects to.booleanawaitTermination(long time, TimeUnit unit) Waits for the channel to become terminated, giving up if the timeout is reached.(package private) InternalSubchannelgetLogId()Returns an ID that is primarily used in debug logs.getState(boolean requestConnectionIgnored) Gets the current connectivity state.com.google.common.util.concurrent.ListenableFuture<InternalChannelz.ChannelStats> getStats()Returns the stats object.(package private) LoadBalancer.Subchannel(package private) void(package private) voidbooleanReturns whether the channel is shutdown.booleanReturns whether the channel is terminated.<RequestT, ResponseT>
ClientCall<RequestT, ResponseT> newCall(MethodDescriptor<RequestT, ResponseT> methodDescriptor, CallOptions callOptions) Create aClientCallto the remote operation specified by the givenMethodDescriptor.voidFor subchannels that are in TRANSIENT_FAILURE state, short-circuit the backoff timer and make them reconnect immediately.(package private) voidsetSubchannel(InternalSubchannel subchannel) shutdown()Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately cancelled.Initiates a forceful shutdown in which preexisting and new calls are cancelled.toString()(package private) voidMethods inherited from class ManagedChannel
enterIdle, notifyWhenStateChanged
-
Field Details
-
log
-
subchannel
-
subchannelImpl
-
subchannelPicker
-
logId
-
authority
-
delayedTransport
-
channelz
-
executorPool
-
executor
-
deadlineCancellationExecutor
-
terminatedLatch
-
shutdown
private volatile boolean shutdown -
channelCallsTracer
-
channelTracer
-
timeProvider
-
transportProvider
-
-
Constructor Details
-
OobChannel
OobChannel(String authority, ObjectPool<? extends Executor> executorPool, ScheduledExecutorService deadlineCancellationExecutor, SynchronizationContext syncContext, CallTracer callsTracer, ChannelTracer channelTracer, InternalChannelz channelz, TimeProvider timeProvider)
-
-
Method Details
-
setSubchannel
-
updateAddresses
-
newCall
public <RequestT, ResponseT> ClientCall<RequestT, ResponseT> newCall(MethodDescriptor<RequestT, ResponseT> methodDescriptor, CallOptions callOptions) Description copied from class:ChannelCreate aClientCallto the remote operation specified by the givenMethodDescriptor. The returnedClientCalldoes not trigger any remote behavior untilClientCall.start(ClientCall.Listener, Metadata)is invoked.- Specified by:
newCallin classChannel- Parameters:
methodDescriptor- describes the name and parameter types of the operation to call.callOptions- runtime options to be applied to this call.- Returns:
- a
ClientCallbound to the specified method.
-
authority
-
isTerminated
public boolean isTerminated()Description copied from class:ManagedChannelReturns whether the channel is terminated. Terminated channels have no running calls and relevant resources released (like TCP connections).- Specified by:
isTerminatedin classManagedChannel- See Also:
-
awaitTermination
Description copied from class:ManagedChannelWaits for the channel to become terminated, giving up if the timeout is reached.- Specified by:
awaitTerminationin classManagedChannel- Returns:
- whether the channel is terminated, as would be done by
ManagedChannel.isTerminated(). - Throws:
InterruptedException
-
getState
Description copied from class:ManagedChannelGets the current connectivity state. Note the result may soon become outdated.Note that the core library did not provide an implementation of this method until v1.6.1.
- Overrides:
getStatein classManagedChannel- Parameters:
requestConnectionIgnored- iftrue, the channel will try to make a connection if it is currently IDLE
-
shutdown
Description copied from class:ManagedChannelInitiates an orderly shutdown in which preexisting calls continue but new calls are immediately cancelled.- Specified by:
shutdownin classManagedChannel- Returns:
- this
-
isShutdown
public boolean isShutdown()Description copied from class:ManagedChannelReturns whether the channel is shutdown. Shutdown channels immediately cancel any new calls, but may still have some calls being processed.- Specified by:
isShutdownin classManagedChannel- See Also:
-
shutdownNow
Description copied from class:ManagedChannelInitiates a forceful shutdown in which preexisting and new calls are cancelled. Although forceful, the shutdown process is still not instantaneous;ManagedChannel.isTerminated()will likely returnfalseimmediately after this method returns.- Specified by:
shutdownNowin classManagedChannel- Returns:
- this
-
handleSubchannelStateChange
-
handleSubchannelTerminated
void handleSubchannelTerminated() -
getSubchannel
LoadBalancer.Subchannel getSubchannel() -
getInternalSubchannel
InternalSubchannel getInternalSubchannel() -
getStats
Description copied from interface:InternalInstrumentedReturns the stats object.- Specified by:
getStatsin interfaceInternalInstrumented<InternalChannelz.ChannelStats>
-
getLogId
Description copied from interface:InternalWithLogIdReturns an ID that is primarily used in debug logs. It usually contains the class name and a numeric ID that is unique among the instances.The subclasses of this interface usually want to include the log ID in their
Object.toString()results.- Specified by:
getLogIdin interfaceInternalWithLogId
-
toString
-
resetConnectBackoff
public void resetConnectBackoff()Description copied from class:ManagedChannelFor subchannels that are in TRANSIENT_FAILURE state, short-circuit the backoff timer and make them reconnect immediately. May also attempt to invokeNameResolver.refresh().This is primarily intended for Android users, where the network may experience frequent temporary drops. Rather than waiting for gRPC's name resolution and reconnect timers to elapse before reconnecting, the app may use this method as a mechanism to notify gRPC that the network is now available and a reconnection attempt may occur immediately.
No-op if not supported by the implementation.
- Overrides:
resetConnectBackoffin classManagedChannel
-