Class SessionOptions


  • public class SessionOptions
    extends java.lang.Object
    Options that control the behavior of the Session created from them.
    • Field Detail

      • DEFAULT_SESSION_INCOMING_CAPACITY

        public static final int DEFAULT_SESSION_INCOMING_CAPACITY
        The default Session configured incoming capacity limit to provide to the remote
        See Also:
        Constant Field Values
      • DEFAULT_SESSION_OUTGOING_CAPACITY

        public static final int DEFAULT_SESSION_OUTGOING_CAPACITY
        The default Session configured outgoing capacity to apply to local pending writes.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SessionOptions

        public SessionOptions()
        Create a new SessionOptions instance configured with default configuration settings.
      • SessionOptions

        public SessionOptions​(SessionOptions options)
        Create a new SessionOptions instance that copies the configuration from the specified source options.
        Parameters:
        options - The SessionOptions instance whose settings are to be copied into this one.
    • Method Detail

      • clone

        public SessionOptions clone()
        Overrides:
        clone in class java.lang.Object
      • copyInto

        protected SessionOptions copyInto​(SessionOptions other)
        Copy all options from this SessionOptions instance into the instance provided.
        Parameters:
        other - the target of this copy operation.
        Returns:
        this options class for chaining.
      • closeTimeout

        public long closeTimeout()
        Returns:
        the timeout used when awaiting a response from the remote when a resource is closed.
      • closeTimeout

        public SessionOptions closeTimeout​(long closeTimeout)
        Configures the timeout used when awaiting a response from the remote that a request to close a Session as been honored.
        Parameters:
        closeTimeout - Timeout value in milliseconds to wait for a remote response.
        Returns:
        this SessionOptions instance.
      • closeTimeout

        public SessionOptions closeTimeout​(long timeout,
                                           java.util.concurrent.TimeUnit units)
        Configures the timeout used when awaiting a response from the remote that a request to close a resource such as a Session, Sender or Receiver h as been honored.
        Parameters:
        timeout - Timeout value to wait for a remote response.
        units - The TimeUnit that defines the timeout span.
        Returns:
        this SessionOptions instance.
      • openTimeout

        public long openTimeout()
        Returns:
        the timeout used when awaiting a response from the remote when a resource is opened.
      • openTimeout

        public SessionOptions openTimeout​(long openTimeout)
        Configures the timeout used when awaiting a response from the remote that a request to open a Session has been honored.
        Parameters:
        openTimeout - Timeout value in milliseconds to wait for a remote response.
        Returns:
        this SessionOptions instance.
      • openTimeout

        public SessionOptions openTimeout​(long timeout,
                                          java.util.concurrent.TimeUnit units)
        Configures the timeout used when awaiting a response from the remote that a request to open a resource such as a Session, Sender or Receiver has been honored.
        Parameters:
        timeout - Timeout value to wait for a remote response.
        units - The TimeUnit that defines the timeout span.
        Returns:
        this SessionOptions instance.
      • sendTimeout

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

        public SessionOptions 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 SessionOptions instance.
      • sendTimeout

        public SessionOptions 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 SessionOptions instance.
      • requestTimeout

        public long requestTimeout()
        Returns:
        the timeout used when awaiting a response from the remote when a resource makes a request.
      • requestTimeout

        public SessionOptions requestTimeout​(long requestTimeout)
        Configures the timeout used when awaiting a response from the remote that a request to perform some action such as starting a new transaction. If the remote does not respond within the configured timeout the resource making the request will mark it as failed and return an error to the request initiator usually in the form of a ClientOperationTimedOutException.
        Parameters:
        requestTimeout - Timeout value in milliseconds to wait for a remote response.
        Returns:
        this SessionOptions instance.
      • requestTimeout

        public SessionOptions requestTimeout​(long timeout,
                                             java.util.concurrent.TimeUnit units)
        Configures the timeout used when awaiting a response from the remote that a request to perform some action such as starting a new transaction. If the remote does not respond within the configured timeout the resource making the request will mark it as failed and return an error to the request initiator usually in the form of a ClientOperationTimedOutException.
        Parameters:
        timeout - Timeout value to wait for a remote response.
        units - The TimeUnit that defines the timeout span.
        Returns:
        this SessionOptions instance.
      • drainTimeout

        public long drainTimeout()
        Returns:
        the configured drain timeout value that will use to fail a pending drain request.
      • drainTimeout

        public SessionOptions drainTimeout​(long drainTimeout)
        Sets the drain timeout (in milliseconds) after which a Receiver request to drain link credit is considered failed and the request will be marked as such.
        Parameters:
        drainTimeout - the drainTimeout to use for receiver links.
        Returns:
        this SessionOptions instance.
      • drainTimeout

        public SessionOptions drainTimeout​(long timeout,
                                           java.util.concurrent.TimeUnit units)
        Sets the drain timeout value after which a Receiver request to drain link credit is considered failed and the request will be marked as such.
        Parameters:
        timeout - Timeout value to wait for a remote response.
        units - The TimeUnit that defines the timeout span.
        Returns:
        this SessionOptions instance.
      • offeredCapabilities

        public java.lang.String[] offeredCapabilities()
        Returns:
        the offeredCapabilities
      • offeredCapabilities

        public SessionOptions offeredCapabilities​(java.lang.String... offeredCapabilities)
        Parameters:
        offeredCapabilities - the offeredCapabilities to set
        Returns:
        this SessionOptions instance.
      • desiredCapabilities

        public java.lang.String[] desiredCapabilities()
        Returns:
        the desiredCapabilities
      • desiredCapabilities

        public SessionOptions desiredCapabilities​(java.lang.String... desiredCapabilities)
        Parameters:
        desiredCapabilities - the desiredCapabilities to set
        Returns:
        this SessionOptions instance.
      • properties

        public java.util.Map<java.lang.String,​java.lang.Object> properties()
        Returns:
        the properties
      • properties

        public SessionOptions properties​(java.util.Map<java.lang.String,​java.lang.Object> properties)
        Parameters:
        properties - the properties to set
        Returns:
        this SessionOptions instance.
      • incomingCapacity

        public int incomingCapacity()
        Returns:
        the incoming capacity that is configured for newly created Session instances.
      • incomingCapacity

        public SessionOptions incomingCapacity​(int incomingCapacity)
        Sets the incoming capacity for a Session created with these options. The incoming capacity controls how much buffering a session will allow before applying back pressure to the remote thereby preventing excessive memory overhead.

        This is an advanced option and in most cases the client defaults should be left in place unless a specific issue needs to be addressed.

        Parameters:
        incomingCapacity - the incoming capacity to set when creating a new Session.
        Returns:
        this SessionOptions instance.
      • outgoingCapacity

        public int outgoingCapacity()
        Returns:
        the outgoing capacity limit that is configured for newly created Session instances.
      • outgoingCapacity

        public SessionOptions outgoingCapacity​(int outgoingCapacity)
        Sets the outgoing capacity for a Session created with these options. The outgoing capacity controls how much buffering a session will allow before applying back pressure to the local thereby preventing excessive memory overhead while writing large amounts of data and the client is experiencing back-pressure due to the remote not keeping pace.

        This is an advanced option and in most cases the client defaults should be left in place unless a specific issue needs to be addressed. Setting this value incorrectly can lead to senders that either block frequently or experience very poor overall performance.

        Parameters:
        outgoingCapacity - the outgoing capacity to set when creating a new Session.
        Returns:
        this SessionOptions instance.