Class StreamSenderOptions

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class StreamSenderOptions
    extends LinkOptions<StreamSenderOptions>
    implements java.lang.Cloneable
    Options class that controls various aspects of a StreamSenderMessage instance and how a streamed message transfer is written.
    • Field Detail

      • DEFAULT_PENDING_WRITES_BUFFER_SIZE

        public static final int DEFAULT_PENDING_WRITES_BUFFER_SIZE
        Defines the default pending write buffering size which is used to control how much outgoing data can be buffered for local writing before the sender has back pressured applied to avoid out of memory conditions due to overly large pending batched writes.
        See Also:
        Constant Field Values
      • MIN_BUFFER_SIZE_LIMIT

        public static final int MIN_BUFFER_SIZE_LIMIT
        Defines the default minimum size that the context write buffer will allocate which drives the interval auto flushing of written data for this context.
        See Also:
        Constant Field Values
    • Constructor Detail

      • StreamSenderOptions

        public StreamSenderOptions()
        Creates a StreamSenderOptions instance with default values for all options
    • Method Detail

      • writeBufferSize

        public int writeBufferSize()
        Returns:
        the configured context write buffering limit for the associated StreamSender
      • writeBufferSize

        public StreamSenderOptions writeBufferSize​(int writeBufferSize)
        Sets the overall number of bytes the stream sender will buffer before automatically flushing the currently buffered bytes. By default the stream sender implementation chooses a value for this buffer limit based on the configured frame size limits of the connection.
        Parameters:
        writeBufferSize - The number of bytes that can be written before the context performs a flush operation.
        Returns:
        this StreamSenderOptions instance.
      • pendingWritesBufferSize

        public int pendingWritesBufferSize()
        Returns:
        the configured pending write buffering limit for the associated StreamSender
      • pendingWritesBufferSize

        public StreamSenderOptions pendingWritesBufferSize​(int pendingWritesBufferSize)
        Sets the overall number of bytes the stream sender will allow to be pending for write before applying back pressure to the stream write caller. By default the stream sender implementation chooses a value for this pending write limit based on the configured frame size limits of the connection. This is an advanced option and should not be used unless the impact of doing so is understood by the user.
        Parameters:
        pendingWritesBufferSize - The number of bytes that can be pending for write before the sender applies back pressure.
        Returns:
        this StreamSenderOptions instance.
      • sendTimeout

        public long sendTimeout()
        Returns:
        the timeout used when awaiting a response from the remote when a resource is message send.
      • sendTimeout

        public StreamSenderOptions sendTimeout​(long sendTimeout)
        Configures the timeout used when awaiting a send operation to complete. A send will block if the remote has not granted the Sender or the Session credit to do so, if the send blocks for longer than this timeout the send call will fail with an ClientSendTimedOutException exception to indicate that the send did not complete.
        Parameters:
        sendTimeout - Timeout value in milliseconds to wait for a remote response.
        Returns:
        this StreamSenderOptions instance.
      • sendTimeout

        public StreamSenderOptions sendTimeout​(long timeout,
                                               java.util.concurrent.TimeUnit units)
        Configures the timeout used when awaiting a send operation to complete. A send will block if the remote has not granted the Sender or the Session credit to do so, if the send blocks for longer than this timeout the send call will fail with an ClientSendTimedOutException exception to indicate that the send did not complete.
        Parameters:
        timeout - Timeout value to wait for a remote response.
        units - The TimeUnit that defines the timeout span.
        Returns:
        this StreamSenderOptions instance.