@ThreadSafe public interface ClientTransport
Stream
instances for communication with the server. All methods on the transport
and its listener are expected to execute quickly.
start(io.grpc.internal.ClientTransport.Listener)
must be the first method call to this interface and return before calling other
methods.
Modifier and Type | Interface and Description |
---|---|
static interface |
ClientTransport.Listener
Receives notifications for the transport life-cycle events.
|
static interface |
ClientTransport.PingCallback
A callback that is invoked when the acknowledgement to a
ping(io.grpc.internal.ClientTransport.PingCallback, java.util.concurrent.Executor) is received. |
Modifier and Type | Method and Description |
---|---|
ClientStream |
newStream(MethodDescriptor<?,?> method,
Metadata.Headers headers,
ClientStreamListener listener)
Creates a new stream for sending messages to the remote end-point.
|
void |
ping(ClientTransport.PingCallback callback,
Executor executor)
Pings the remote endpoint to verify that the transport is still active.
|
void |
shutdown()
Initiates an orderly shutdown of the transport.
|
void |
start(ClientTransport.Listener listener)
Starts transport.
|
ClientStream newStream(MethodDescriptor<?,?> method, Metadata.Headers headers, ClientStreamListener listener)
This method returns immediately and does not wait for any validation of the request. If
creation fails for any reason, ClientStreamListener.closed(io.grpc.Status, io.grpc.Metadata.Trailers)
will be called to provide
the error information. Any sent messages for this stream will be buffered until creation has
completed (either successfully or unsuccessfully).
method
- the descriptor of the remote method to be called for this stream.headers
- to send at the beginning of the calllistener
- the listener for the newly created stream.IllegalStateException
- if the service is already stopped.void start(ClientTransport.Listener listener)
Implementations must not call listener
from within start(io.grpc.internal.ClientTransport.Listener)
; implementations
are expected to notify listener on a separate thread. This method should not throw any
exceptions.
listener
- non-null
listener of transport eventsvoid ping(ClientTransport.PingCallback callback, Executor executor)
This is an optional method. Transports that do not have any mechanism by which to ping the
remote endpoint may throw UnsupportedOperationException
.
void shutdown()
ClientTransport.Listener.transportShutdown(io.grpc.Status)
callback called). This method may only be called
once.