Class ClientCallImpl<ReqT,RespT>
ClientCall.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final classprivate class(package private) static interfaceProvider ofClientStreams.Nested classes/interfaces inherited from class io.grpc.ClientCall
ClientCall.Listener<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Executorprivate final booleanprivate CallOptionsprivate booleanprivate ClientCallImpl<ReqT,RespT>.CancellationHandler private final CallTracerprivate final ClientCallImpl.ClientStreamProviderprivate CompressorRegistryprivate final Contextprivate final ScheduledExecutorServiceprivate DecompressorRegistryprivate static final byte[]private booleanprivate booleanprivate static final Loggerprivate final MethodDescriptor<ReqT, RespT> private static final doubleprivate ClientStreamprivate final io.perfmark.Tagprivate final boolean -
Constructor Summary
ConstructorsConstructorDescriptionClientCallImpl(MethodDescriptor<ReqT, RespT> method, Executor executor, CallOptions callOptions, ClientCallImpl.ClientStreamProvider clientStreamProvider, ScheduledExecutorService deadlineCancellationExecutor, CallTracer channelCallsTracer, InternalConfigSelector configSelector) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidvoidPrevent any further processing for thisClientCall.private voidcancelInternal(String message, Throwable cause) private voidcloseObserver(ClientCall.Listener<RespT> observer, Status status, Metadata trailers) private DeadlineReturns additional properties of the call.voidClose the call for request message sending.private voidbooleanisReady()Iftrue, indicates that the call is capable of sending additional messages without requiring excessive buffering internally.private static Deadline(package private) static voidprepareHeaders(Metadata headers, DecompressorRegistry decompressorRegistry, Compressor compressor, boolean fullStreamDecompression) voidrequest(int numMessages) Requests up to the given number of messages from the call to be delivered toClientCall.Listener.onMessage(Object).voidsendMessage(ReqT message) Send a request message to the server.private voidsendMessageInternal(ReqT message) (package private) ClientCallImpl<ReqT, RespT> setCompressorRegistry(CompressorRegistry compressorRegistry) (package private) ClientCallImpl<ReqT, RespT> setDecompressorRegistry(DecompressorRegistry decompressorRegistry) (package private) ClientCallImpl<ReqT, RespT> setFullStreamDecompression(boolean fullStreamDecompression) voidsetMessageCompression(boolean enabled) Enables per-message compression, if an encoding type has been negotiated.voidstart(ClientCall.Listener<RespT> observer, Metadata headers) Start a call, usingresponseListenerfor processing response messages.private voidstartInternal(ClientCall.Listener<RespT> observer, Metadata headers) toString()
-
Field Details
-
log
-
FULL_STREAM_DECOMPRESSION_ENCODINGS
private static final byte[] FULL_STREAM_DECOMPRESSION_ENCODINGS -
NANO_TO_SECS
private static final double NANO_TO_SECS -
method
-
tag
private final io.perfmark.Tag tag -
callExecutor
-
callExecutorIsDirect
private final boolean callExecutorIsDirect -
channelCallsTracer
-
context
-
cancellationHandler
-
unaryRequest
private final boolean unaryRequest -
callOptions
-
stream
-
cancelCalled
private boolean cancelCalled -
halfCloseCalled
private boolean halfCloseCalled -
clientStreamProvider
-
deadlineCancellationExecutor
-
fullStreamDecompression
private boolean fullStreamDecompression -
decompressorRegistry
-
compressorRegistry
-
-
Constructor Details
-
ClientCallImpl
ClientCallImpl(MethodDescriptor<ReqT, RespT> method, Executor executor, CallOptions callOptions, ClientCallImpl.ClientStreamProvider clientStreamProvider, ScheduledExecutorService deadlineCancellationExecutor, CallTracer channelCallsTracer, @Nullable InternalConfigSelector configSelector)
-
-
Method Details
-
setFullStreamDecompression
-
setDecompressorRegistry
-
setCompressorRegistry
-
prepareHeaders
static void prepareHeaders(Metadata headers, DecompressorRegistry decompressorRegistry, Compressor compressor, boolean fullStreamDecompression) -
start
Description copied from class:ClientCallStart a call, usingresponseListenerfor processing response messages.It must be called prior to any other method on this class, except for
ClientCall.cancel(java.lang.String, java.lang.Throwable)which may be called at any time.Since
Metadatais not thread-safe, the caller must not access (read or write)headersafter this point.- Specified by:
startin classClientCall<ReqT,RespT> - Parameters:
observer- receives response messagesheaders- which can contain extra call metadata, e.g. authentication credentials.
-
startInternal
-
applyMethodConfig
private void applyMethodConfig() -
effectiveDeadline
-
min
-
request
public void request(int numMessages) Description copied from class:ClientCallRequests up to the given number of messages from the call to be delivered toClientCall.Listener.onMessage(Object). No additional messages will be delivered.Message delivery is guaranteed to be sequential in the order received. In addition, the listener methods will not be accessed concurrently. While it is not guaranteed that the same thread will always be used, it is guaranteed that only a single thread will access the listener at a time.
If it is desired to bypass inbound flow control, a very large number of messages can be specified (e.g.
Integer.MAX_VALUE).If called multiple times, the number of messages able to delivered will be the sum of the calls.
This method is safe to call from multiple threads without external synchronization.
- Specified by:
requestin classClientCall<ReqT,RespT> - Parameters:
numMessages- the requested number of messages to be delivered to the listener. Must be non-negative.
-
cancel
Description copied from class:ClientCallPrevent any further processing for thisClientCall. No further messages may be sent or will be received. The server is informed of cancellations, but may not stop processing the call. Cancellation is permitted even if previouslyClientCall.halfClose()d. Cancelling an alreadycancel()edClientCallhas no effect.No other methods on this class can be called after this method has been called.
It is recommended that at least one of the arguments to be non-
null, to provide useful debug information. Both argument being null may log warnings and result in suboptimal performance. Also note that the provided information will not be sent to the server.- Specified by:
cancelin classClientCall<ReqT,RespT> - Parameters:
message- if notnull, will appear as the description of the CANCELLED statuscause- if notnull, will appear as the cause of the CANCELLED status
-
cancelInternal
-
halfClose
public void halfClose()Description copied from class:ClientCallClose the call for request message sending. Incoming response messages are unaffected. This should be called when no more messages will be sent from the client.- Specified by:
halfClosein classClientCall<ReqT,RespT>
-
halfCloseInternal
private void halfCloseInternal() -
sendMessage
Description copied from class:ClientCallSend a request message to the server. May be called zero or more times depending on how many messages the server is willing to accept for the operation.- Specified by:
sendMessagein classClientCall<ReqT,RespT> - Parameters:
message- message to be sent to the server.
-
sendMessageInternal
-
setMessageCompression
public void setMessageCompression(boolean enabled) Description copied from class:ClientCallEnables per-message compression, if an encoding type has been negotiated. If no message encoding has been negotiated, this is a no-op. By default per-message compression is enabled, but may not have any effect if compression is not enabled on the call.- Overrides:
setMessageCompressionin classClientCall<ReqT,RespT>
-
isReady
public boolean isReady()Description copied from class:ClientCallIftrue, indicates that the call is capable of sending additional messages without requiring excessive buffering internally. This event is just a suggestion and the application is free to ignore it, however doing so may result in excessive buffering within the call.If
false,ClientCall.Listener.onReady()will be called afterisReady()transitions totrue.If the type of the call is either
MethodDescriptor.MethodType.UNARYorMethodDescriptor.MethodType.SERVER_STREAMING, this method may persistently return false. Calls that send exactly one message should not check this method.This abstract class's implementation always returns
true. Implementations generally override the method.- Overrides:
isReadyin classClientCall<ReqT,RespT>
-
getAttributes
Description copied from class:ClientCallReturns additional properties of the call. May only be called afterClientCall.Listener.onHeaders(io.grpc.Metadata)orClientCall.Listener.onClose(io.grpc.Status, io.grpc.Metadata). If called prematurely, the implementation may throwIllegalStateExceptionor return arbitraryAttributes.- Overrides:
getAttributesin classClientCall<ReqT,RespT> - Returns:
- non-
nullattributes
-
closeObserver
-
toString
-