@ThreadSafe public interface ManagedClientTransport extends ClientTransport
ClientTransport
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)
, while some
implementations may transfer the streams to somewhere else. Either way they must conform to the
contract defined by shutdown(io.grpc.Status)
, ManagedClientTransport.Listener.transportShutdown(io.grpc.Status)
and
ManagedClientTransport.Listener.transportTerminated()
.
Modifier and Type | Interface and Description |
---|---|
static interface |
ManagedClientTransport.Listener
Receives notifications for the transport life-cycle events.
|
ClientTransport.PingCallback
Modifier and Type | Method and 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.
|
Runnable |
start(ManagedClientTransport.Listener listener)
Starts transport.
|
newStream, ping
getStats
getLogId
@CheckReturnValue @Nullable Runnable start(ManagedClientTransport.Listener listener)
Implementations must not call listener
from within start(io.grpc.internal.ManagedClientTransport.Listener)
; implementations
are expected to notify listener on a separate thread or when the returned Runnable
is
run. This method and the returned Runnable
should not throw any exceptions.
listener
- non-null
listener of transport eventsRunnable
that is executed after-the-fact by the original caller, typically
after locks are releasedvoid shutdown(Status reason)
ManagedClientTransport.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.void shutdownNow(Status reason)
reason
.Copyright © 2019. All rights reserved.