Package io.grpc.internal
Interface ManagedClientTransport
-
- All Superinterfaces:
ClientTransport
,InternalInstrumented<InternalChannelz.SocketStats>
,InternalWithLogId
- All Known Subinterfaces:
ConnectionClientTransport
- All Known Implementing Classes:
CallCredentialsApplyingTransportFactory.CallCredentialsApplyingTransport
,DelayedClientTransport
,ForwardingConnectionClientTransport
,InProcessTransport
,InternalSubchannel.CallTracingTransport
,NettyClientTransport
@ThreadSafe public interface ManagedClientTransport extends ClientTransport
AClientTransport
that has life-cycle management.start(io.grpc.internal.ManagedClientTransport.Listener)
must be the first method call to this interface and return before calling other methods.Typically the transport owns the streams it creates through
ClientTransport.newStream(io.grpc.MethodDescriptor<?, ?>, io.grpc.Metadata, io.grpc.CallOptions, io.grpc.ClientStreamTracer[])
, while some implementations may transfer the streams to somewhere else. Either way they must conform to the contract defined byshutdown(io.grpc.Status)
,ManagedClientTransport.Listener.transportShutdown(io.grpc.Status)
andManagedClientTransport.Listener.transportTerminated()
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ManagedClientTransport.Listener
Receives notifications for the transport life-cycle events.-
Nested classes/interfaces inherited from interface io.grpc.internal.ClientTransport
ClientTransport.PingCallback
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
shutdown(Status reason)
Initiates an orderly shutdown of the transport.void
shutdownNow(Status reason)
Initiates a forceful shutdown in which preexisting and new calls are closed.java.lang.Runnable
start(ManagedClientTransport.Listener listener)
Starts transport.-
Methods inherited from interface io.grpc.internal.ClientTransport
newStream, ping
-
Methods inherited from interface io.grpc.InternalInstrumented
getStats
-
Methods inherited from interface io.grpc.InternalWithLogId
getLogId
-
-
-
-
Method Detail
-
start
@CheckReturnValue @Nullable java.lang.Runnable start(ManagedClientTransport.Listener listener)
Starts transport. This method may only be called once.This method and the returned
Runnable
should not throw any exceptions.- Parameters:
listener
- non-null
listener of transport events- Returns:
- a
Runnable
that is executed after-the-fact by the original caller, typically after locks are released
-
shutdown
void shutdown(Status reason)
Initiates an orderly shutdown of the transport. Existing streams continue, but the transport will not own any new streams. New streams will either fail (onceManagedClientTransport.Listener.transportShutdown(io.grpc.Status)
callback called), or be transferred off this transport (in which case they may succeed). This method may only be called once.
-
shutdownNow
void shutdownNow(Status reason)
Initiates a forceful shutdown in which preexisting and new calls are closed. Existing calls should be closed with the providedreason
.
-
-