Class AbstractServerStream.TransportState

    • Field Detail

      • listenerClosed

        private boolean listenerClosed
        Whether listener.closed() has been called.
      • endOfStream

        private boolean endOfStream
      • deframerClosed

        private boolean deframerClosed
      • immediateCloseRequested

        private boolean immediateCloseRequested
      • deframerClosedTask

        private java.lang.Runnable deframerClosedTask
      • closedStatus

        @Nullable
        private Status closedStatus
        The status that the application used to close this stream.
    • Method Detail

      • setListener

        public final void setListener​(ServerStreamListener listener)
        Sets the listener to receive notifications. Must be called in the context of the transport thread.
      • onStreamAllocated

        public final void onStreamAllocated()
        Description copied from class: AbstractStream.TransportState
        Event handler to be called by the subclass when the stream's headers have passed any connection flow control (i.e., MAX_CONCURRENT_STREAMS). It may call the listener's StreamListener.onReady() handler if appropriate. This must be called from the transport thread, since the listener may be called back directly.
        Overrides:
        onStreamAllocated in class AbstractStream.TransportState
      • deframerClosed

        public void deframerClosed​(boolean hasPartialMessage)
        Description copied from interface: MessageDeframer.Listener
        Called when the deframer closes.
        Parameters:
        hasPartialMessage - whether the deframer contained an incomplete message at closing.
      • inboundDataReceived

        public void inboundDataReceived​(ReadableBuffer frame,
                                        boolean endOfStream)
        Called in the transport thread to process the content of an inbound DATA frame from the client.
        Parameters:
        frame - the inbound HTTP/2 DATA frame. If this buffer is not used immediately, it must be retained.
        endOfStream - true if no more data will be received on the stream.
      • transportReportStatus

        public final void transportReportStatus​(Status status)
        Notifies failure to the listener of the stream. The transport is responsible for notifying the client of the failure independent of this method.

        Unlike AbstractServerStream.close(Status, Metadata), this method is only called from the transport. The transport should use this method instead of close(Status) for internal errors to prevent exposing unexpected states and exceptions to the application.

        Parameters:
        status - the error status. Must not be Status.OK.
      • complete

        public void complete()
        Indicates the stream is considered completely closed and there is no further opportunity for error. It calls the listener's closed() if it was not already done by transportReportStatus(io.grpc.Status).
      • closeListener

        private void closeListener​(Status newStatus)
        Closes the listener if not previously closed and frees resources. newStatus is a status generated by gRPC. It is not the status the stream closed with.
      • setClosedStatus

        private void setClosedStatus​(Status closeStatus)
        Stores the Status that the application used to close this stream.