Package org.apache.qpid.protonj2.client
Class SessionOptions
- java.lang.Object
-
- org.apache.qpid.protonj2.client.SessionOptions
-
public class SessionOptions extends java.lang.Object
Options that control the behavior of theSession
created from them.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_SESSION_INCOMING_CAPACITY
The default Session configured incoming capacity limit to provide to the remotestatic int
DEFAULT_SESSION_OUTGOING_CAPACITY
The default Session configured outgoing capacity to apply to local pending writes.
-
Constructor Summary
Constructors Constructor Description SessionOptions()
Create a newSessionOptions
instance 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 SessionOptions
clone()
long
closeTimeout()
SessionOptions
closeTimeout(long closeTimeout)
Configures the timeout used when awaiting a response from the remote that a request to close aSession
as been honored.SessionOptions
closeTimeout(long timeout, java.util.concurrent.TimeUnit units)
protected SessionOptions
copyInto(SessionOptions other)
Copy all options from thisSessionOptions
instance into the instance provided.java.lang.String[]
desiredCapabilities()
SessionOptions
desiredCapabilities(java.lang.String... desiredCapabilities)
long
drainTimeout()
SessionOptions
drainTimeout(long drainTimeout)
Sets the drain timeout (in milliseconds) after which aReceiver
request to drain link credit is considered failed and the request will be marked as such.SessionOptions
drainTimeout(long timeout, java.util.concurrent.TimeUnit units)
Sets the drain timeout value after which aReceiver
request to drain link credit is considered failed and the request will be marked as such.int
incomingCapacity()
SessionOptions
incomingCapacity(int incomingCapacity)
Sets the incoming capacity for aSession
created with these options.java.lang.String[]
offeredCapabilities()
SessionOptions
offeredCapabilities(java.lang.String... offeredCapabilities)
long
openTimeout()
SessionOptions
openTimeout(long openTimeout)
Configures the timeout used when awaiting a response from the remote that a request to open aSession
has been honored.SessionOptions
openTimeout(long timeout, java.util.concurrent.TimeUnit units)
int
outgoingCapacity()
SessionOptions
outgoingCapacity(int outgoingCapacity)
Sets the outgoing capacity for aSession
created with these options.java.util.Map<java.lang.String,java.lang.Object>
properties()
SessionOptions
properties(java.util.Map<java.lang.String,java.lang.Object> properties)
long
requestTimeout()
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.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.long
sendTimeout()
SessionOptions
sendTimeout(long sendTimeout)
Configures the timeout used when awaiting a send operation to complete.SessionOptions
sendTimeout(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 newSessionOptions
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 classjava.lang.Object
-
copyInto
protected SessionOptions copyInto(SessionOptions other)
Copy all options from thisSessionOptions
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 aSession
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 aSession
,Sender
orReceiver
h as been honored.- Parameters:
timeout
- Timeout value to wait for a remote response.units
- TheTimeUnit
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 aSession
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 aSession
,Sender
orReceiver
has been honored.- Parameters:
timeout
- Timeout value to wait for a remote response.units
- TheTimeUnit
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 theSender
or theSession
credit to do so, if the send blocks for longer than this timeout the send call will fail with anClientSendTimedOutException
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 theSender
or theSession
credit to do so, if the send blocks for longer than this timeout the send call will fail with anClientSendTimedOutException
exception to indicate that the send did not complete.- Parameters:
timeout
- Timeout value to wait for a remote response.units
- TheTimeUnit
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 aClientOperationTimedOutException
.- 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 aClientOperationTimedOutException
.- Parameters:
timeout
- Timeout value to wait for a remote response.units
- TheTimeUnit
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 aReceiver
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 aReceiver
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
- TheTimeUnit
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 aSession
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 newSession
.- 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 aSession
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 newSession
.- Returns:
- this
SessionOptions
instance.
-
-