Class AbstractServerStream

    • Field Detail

      • outboundClosed

        private boolean outboundClosed
      • headersSent

        private boolean headersSent
    • Method Detail

      • abstractServerStreamSink

        protected abstract AbstractServerStream.Sink abstractServerStreamSink()
        Sink for transport to be called to perform outbound operations. Each stream must have its own unique sink.
      • deliverFrame

        public final void deliverFrame​(WritableBuffer frame,
                                       boolean endOfStream,
                                       boolean flush,
                                       int numMessages)
        Description copied from interface: MessageFramer.Sink
        Delivers a frame via the transport.
        Specified by:
        deliverFrame in interface MessageFramer.Sink
        Parameters:
        frame - a non-empty buffer to deliver or null if the framer is being closed and there is no data to deliver.
        endOfStream - whether the frame is the last one for the GRPC stream
        flush - true if more data may not be arriving soon
        numMessages - the number of messages that this series of frames represents
      • close

        public final void close​(Status status,
                                Metadata trailers)
        Description copied from interface: ServerStream
        Closes the stream for both reading and writing. A status code of Status.Code.OK implies normal termination of the stream. Any other value implies abnormal termination.

        Attempts to read from or write to the stream after closing should be ignored by implementations, and should not throw exceptions.

        Specified by:
        close in interface ServerStream
        Parameters:
        status - details of the closure
        trailers - an additional block of metadata to pass to the client on stream closure.
      • addStatusToTrailers

        private void addStatusToTrailers​(Metadata trailers,
                                         Status status)
      • cancel

        public final void cancel​(Status status)
        Description copied from interface: ServerStream
        Tears down the stream, typically in the event of a timeout. This method may be called multiple times and from any thread.
        Specified by:
        cancel in interface ServerStream
      • isReady

        public final boolean isReady()
        Description copied from interface: Stream
        If true, indicates that the transport is capable of sending additional messages without requiring excessive buffering internally. Otherwise, StreamListener.onReady() will be called when it turns true.

        This is just a suggestion and the application is free to ignore it, however doing so may result in excessive buffering within the transport.

        Specified by:
        isReady in interface Stream
        Overrides:
        isReady in class AbstractStream
      • setDecompressor

        public final void setDecompressor​(Decompressor decompressor)
        Description copied from interface: ServerStream
        Sets the decompressor on the deframer. If the transport does not support compression, this may do nothing.
        Specified by:
        setDecompressor in interface ServerStream
        Parameters:
        decompressor - the decompressor to use.
      • getAuthority

        public java.lang.String getAuthority()
        Description copied from interface: ServerStream
        Gets the authority this stream is addressed to.
        Specified by:
        getAuthority in interface ServerStream
        Returns:
        the authority string. null if not available.
      • setOnReadyThreshold

        public void setOnReadyThreshold​(int numBytes)
        A hint to the stream that specifies how many bytes must be queued before isReady() will return false. A stream may ignore this property if unsupported. This may only be set before any messages are sent.
        Specified by:
        setOnReadyThreshold in interface ServerStream
        Overrides:
        setOnReadyThreshold in class AbstractStream
        Parameters:
        numBytes - The number of bytes that must be queued. Must be a positive integer.