Class ServerConnectionContinuation

  • All Implemented Interfaces:
    AutoCloseable

    public class ServerConnectionContinuation
    extends CrtResource
    Wrapper around aws-event-stream-rpc-server continuation. This class is marked AutoClosable. Note that by default ServerConnectionContinuationHandler will invoke close() in ServerConnectionContinuationHandler::onContinuationClosed().
    • Method Detail

      • isClosed

        public boolean isClosed()
        Returns:
        true if the continuation has been closed. False otherwise.
      • sendMessage

        public CompletableFuture<Void> sendMessage​(List<Header> headers,
                                                   byte[] payload,
                                                   MessageType messsageType,
                                                   int messageFlags)
        Sends message on the continuation
        Parameters:
        headers - list of additional event stream headers to include on the message.
        payload - payload for the message
        messsageType - message type. Must be either ApplicationMessage or ApplicationError
        messageFlags - message flags for the message, use TerminateStream to cause this message to close the continuation after sending.
        Returns:
        Future for syncing when the message is flushed to the transport or fails.
      • sendMessage

        public void sendMessage​(List<Header> headers,
                                byte[] payload,
                                MessageType messageType,
                                int messageFlags,
                                MessageFlushCallback callback)
        Sends message on the continuation
        Parameters:
        headers - list of additional event stream headers to include on the message.
        payload - payload for the message
        messageType - message type. Must be either ApplicationMessage or ApplicationError
        messageFlags - message flags for the message, use TerminateStream to cause this message to close the continuation after sending.
        callback - completion callback to be invoked when the message is synced to the underlying transport.
      • releaseNativeHandle

        protected void releaseNativeHandle()
        Description copied from class: CrtResource
        Required override method that must begin the release process of the acquired native handle
        Specified by:
        releaseNativeHandle in class CrtResource
      • canReleaseReferencesImmediately

        protected boolean canReleaseReferencesImmediately()
        Description copied from class: CrtResource
        Override that determines whether a resource releases its dependencies at the same time the native handle is released or if it waits. Resources with asynchronous shutdown processes should override this with false, and establish a callback from native code that invokes releaseReferences() when the asynchronous shutdown process has completed. See HttpClientConnectionManager for an example.
        Specified by:
        canReleaseReferencesImmediately in class CrtResource
        Returns:
        true if this resource releases synchronously, false if this resource performs async shutdown