Package org.apache.qpid.protonj2.client
Class SessionOptions
- java.lang.Object
-
- org.apache.qpid.protonj2.client.SessionOptions
-
public class SessionOptions extends java.lang.ObjectOptions that control the behavior of theSessioncreated from them.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_SESSION_INCOMING_CAPACITYThe default Session configured incoming capacity limit to provide to the remotestatic intDEFAULT_SESSION_OUTGOING_CAPACITYThe default Session configured outgoing capacity to apply to local pending writes.
-
Constructor Summary
Constructors Constructor Description SessionOptions()Create a newSessionOptionsinstance configured with default configuration settings.SessionOptions(SessionOptions options)Create a new SessionOptions instance that copies the configuration from the specified source options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SessionOptionsclone()longcloseTimeout()SessionOptionscloseTimeout(long closeTimeout)Configures the timeout used when awaiting a response from the remote that a request to close aSessionas been honored.SessionOptionscloseTimeout(long timeout, java.util.concurrent.TimeUnit units)protected SessionOptionscopyInto(SessionOptions other)Copy all options from thisSessionOptionsinstance into the instance provided.java.lang.String[]desiredCapabilities()SessionOptionsdesiredCapabilities(java.lang.String... desiredCapabilities)longdrainTimeout()SessionOptionsdrainTimeout(long drainTimeout)Sets the drain timeout (in milliseconds) after which aReceiverrequest to drain link credit is considered failed and the request will be marked as such.SessionOptionsdrainTimeout(long timeout, java.util.concurrent.TimeUnit units)Sets the drain timeout value after which aReceiverrequest to drain link credit is considered failed and the request will be marked as such.intincomingCapacity()SessionOptionsincomingCapacity(int incomingCapacity)Sets the incoming capacity for aSessioncreated with these options.java.lang.String[]offeredCapabilities()SessionOptionsofferedCapabilities(java.lang.String... offeredCapabilities)longopenTimeout()SessionOptionsopenTimeout(long openTimeout)Configures the timeout used when awaiting a response from the remote that a request to open aSessionhas been honored.SessionOptionsopenTimeout(long timeout, java.util.concurrent.TimeUnit units)intoutgoingCapacity()SessionOptionsoutgoingCapacity(int outgoingCapacity)Sets the outgoing capacity for aSessioncreated with these options.java.util.Map<java.lang.String,java.lang.Object>properties()SessionOptionsproperties(java.util.Map<java.lang.String,java.lang.Object> properties)longrequestTimeout()SessionOptionsrequestTimeout(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.SessionOptionsrequestTimeout(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.longsendTimeout()SessionOptionssendTimeout(long sendTimeout)Configures the timeout used when awaiting a send operation to complete.SessionOptionssendTimeout(long timeout, java.util.concurrent.TimeUnit units)Configures the timeout used when awaiting a send operation to complete.
-
-
-
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 newSessionOptionsinstance 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:
clonein classjava.lang.Object
-
copyInto
protected SessionOptions copyInto(SessionOptions other)
Copy all options from thisSessionOptionsinstance 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 aSessionas been honored.- Parameters:
closeTimeout- Timeout value in milliseconds to wait for a remote response.- Returns:
- this
SessionOptionsinstance.
-
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 aSession,SenderorReceiverh as been honored.- Parameters:
timeout- Timeout value to wait for a remote response.units- TheTimeUnitthat defines the timeout span.- Returns:
- this
SessionOptionsinstance.
-
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 aSessionhas been honored.- Parameters:
openTimeout- Timeout value in milliseconds to wait for a remote response.- Returns:
- this
SessionOptionsinstance.
-
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 aSession,SenderorReceiverhas been honored.- Parameters:
timeout- Timeout value to wait for a remote response.units- TheTimeUnitthat defines the timeout span.- Returns:
- this
SessionOptionsinstance.
-
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 theSenderor theSessioncredit to do so, if the send blocks for longer than this timeout the send call will fail with anClientSendTimedOutExceptionexception to indicate that the send did not complete.- Parameters:
sendTimeout- Timeout value in milliseconds to wait for a remote response.- Returns:
- this
SessionOptionsinstance.
-
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 theSenderor theSessioncredit to do so, if the send blocks for longer than this timeout the send call will fail with anClientSendTimedOutExceptionexception to indicate that the send did not complete.- Parameters:
timeout- Timeout value to wait for a remote response.units- TheTimeUnitthat defines the timeout span.- Returns:
- this
SessionOptionsinstance.
-
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 aClientOperationTimedOutException.- Parameters:
requestTimeout- Timeout value in milliseconds to wait for a remote response.- Returns:
- this
SessionOptionsinstance.
-
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 aClientOperationTimedOutException.- Parameters:
timeout- Timeout value to wait for a remote response.units- TheTimeUnitthat defines the timeout span.- Returns:
- this
SessionOptionsinstance.
-
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 aReceiverrequest 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
SessionOptionsinstance.
-
drainTimeout
public SessionOptions drainTimeout(long timeout, java.util.concurrent.TimeUnit units)
Sets the drain timeout value after which aReceiverrequest 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- TheTimeUnitthat defines the timeout span.- Returns:
- this
SessionOptionsinstance.
-
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
SessionOptionsinstance.
-
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
SessionOptionsinstance.
-
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
SessionOptionsinstance.
-
incomingCapacity
public int incomingCapacity()
- Returns:
- the incoming capacity that is configured for newly created
Sessioninstances.
-
incomingCapacity
public SessionOptions incomingCapacity(int incomingCapacity)
Sets the incoming capacity for aSessioncreated 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 newSession.- Returns:
- this
SessionOptionsinstance.
-
outgoingCapacity
public int outgoingCapacity()
- Returns:
- the outgoing capacity limit that is configured for newly created
Sessioninstances.
-
outgoingCapacity
public SessionOptions outgoingCapacity(int outgoingCapacity)
Sets the outgoing capacity for aSessioncreated 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 newSession.- Returns:
- this
SessionOptionsinstance.
-
-