Package io.grpc

Class ForwardingServerCall<ReqT,​RespT>

    • Constructor Detail

      • ForwardingServerCall

        public ForwardingServerCall()
    • Method Detail

      • delegate

        protected abstract ServerCall<ReqT,​RespT> delegate()
        Returns the delegated ServerCall.
      • sendMessage

        public void sendMessage​(RespT message)
        Description copied from class: ServerCall
        Send a response message. Messages are the primary form of communication associated with RPCs. Multiple response messages may exist for streaming calls.
        Specified by:
        sendMessage in class ServerCall<ReqT,​RespT>
        message - response message.
      • request

        public void request​(int numMessages)
        Description copied from class: ServerCall
        Requests up to the given number of messages from the call to be delivered to ServerCall.Listener.onMessage(Object). Once numMessages have been delivered no further request messages will be delivered until more messages are requested by calling this method again.

        Servers use this mechanism to provide back-pressure to the client for flow-control.

        This method is safe to call from multiple threads without external synchronization.

        Specified by:
        request in class ServerCall<ReqT,​RespT>
        numMessages - the requested number of messages to be delivered to the listener.
      • isReady

        public boolean isReady()
        Description copied from class: ServerCall
        If true, 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, ServerCall.Listener.onReady() will be called after isReady() transitions to true.

        This abstract class's implementation always returns true. Implementations generally override the method.

        isReady in class ServerCall<ReqT,​RespT>
      • close

        public void close​(Status status,
                          Metadata trailers)
        Description copied from class: ServerCall
        Close the call with the provided status. No further sending or receiving will occur. If Status.isOk() is false, then the call is said to have failed.

        If no errors or cancellations are known to have occurred, then a ServerCall.Listener.onComplete() notification should be expected, independent of status. Otherwise ServerCall.Listener.onCancel() has been or will be called.

        Since Metadata is not thread-safe, the caller must not access (read or write) trailers after this point.

        This method implies the caller completed processing the RPC, but it does not imply the RPC is complete. The call implementation will need additional time to complete the RPC and during this time the client is still able to cancel the request or a network error might cause the RPC to fail. If you wish to know when the call is actually completed/closed, you have to use ServerCall.Listener.onComplete() or ServerCall.Listener.onCancel() instead. This method is not necessarily invoked when Listener.onCancel() is called.

        Specified by:
        close in class ServerCall<ReqT,​RespT>
      • isCancelled

        public boolean isCancelled()
        Description copied from class: ServerCall
        Returns true when the call is cancelled and the server is encouraged to abort processing to save resources, since the client will not be processing any further methods. Cancellations can be caused by timeouts, explicit cancel by client, network errors, and similar.

        This method may safely be called concurrently from multiple threads.

        Specified by:
        isCancelled in class ServerCall<ReqT,​RespT>
      • setMessageCompression

        public void setMessageCompression​(boolean enabled)
        Description copied from class: ServerCall
        Enables 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.
        setMessageCompression in class ServerCall<ReqT,​RespT>
      • setCompression

        public void setCompression​(java.lang.String compressor)
        Description copied from class: ServerCall
        Sets the compression algorithm for this call. This compression is utilized for sending. If the server does not support the compression algorithm, the call will fail. This method may only be called before ServerCall.sendHeaders(io.grpc.Metadata). The compressor to use will be looked up in the CompressorRegistry. Default gRPC servers support the "gzip" compressor.

        It is safe to call this even if the client does not support the compression format chosen. The implementation will handle negotiation with the client and may fall back to no compression.

        setCompression in class ServerCall<ReqT,​RespT>
        compressor - the name of the compressor to use.
      • getAuthority

        public java.lang.String getAuthority()
        Description copied from class: ServerCall
        Gets the authority this call is addressed to.
        getAuthority in class ServerCall<ReqT,​RespT>
        the authority string. null if not available.
      • getSecurityLevel

        public SecurityLevel getSecurityLevel()
        Description copied from class: ServerCall
        Returns the level of security guarantee in communications

        Determining the level of security offered by the transport for RPCs on server-side. This can be approximated by looking for the SSLSession, but that doesn't work for ALTS and maybe some future TLS approaches. May return a lower security level when it cannot be determined precisely.

        getSecurityLevel in class ServerCall<ReqT,​RespT>
        non-null SecurityLevel enum
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object