Package org.apache.qpid.protonj2.client
Class SessionOptions
java.lang.Object
org.apache.qpid.protonj2.client.SessionOptions
- All Implemented Interfaces:
Cloneable
Options that control the behavior of the
Session
created from them.-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The default Session configured incoming capacity limit to provide to the remotestatic final int
The default Session configured outgoing capacity to apply to local pending writes. -
Constructor Summary
ConstructorDescriptionCreate 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
Modifier and TypeMethodDescriptionclone()
long
closeTimeout
(long closeTimeout) Configures the timeout used when awaiting a response from the remote that a request to close aSession
as been honored.closeTimeout
(long timeout, TimeUnit units) protected SessionOptions
copyInto
(SessionOptions other) Copy all options from thisSessionOptions
instance into the instance provided.Configures the default next receiver policy for the session created with these configuration options.String[]
desiredCapabilities
(String... desiredCapabilities) long
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.drainTimeout
(long timeout, 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
(int incomingCapacity) Sets the incoming capacity for aSession
created with these options.String[]
offeredCapabilities
(String... offeredCapabilities) long
openTimeout
(long openTimeout) Configures the timeout used when awaiting a response from the remote that a request to open aSession
has been honored.openTimeout
(long timeout, TimeUnit units) int
outgoingCapacity
(int outgoingCapacity) Sets the outgoing capacity for aSession
created with these options.properties
(Map<String, Object> properties) long
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.requestTimeout
(long timeout, 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
(long sendTimeout) Configures the timeout used when awaiting a send operation to complete.sendTimeout
(long timeout, TimeUnit units) Configures the timeout used when awaiting a send operation to complete.
-
Field Details
-
DEFAULT_SESSION_INCOMING_CAPACITY
public static final int DEFAULT_SESSION_INCOMING_CAPACITYThe default Session configured incoming capacity limit to provide to the remote- See Also:
-
DEFAULT_SESSION_OUTGOING_CAPACITY
public static final int DEFAULT_SESSION_OUTGOING_CAPACITYThe default Session configured outgoing capacity to apply to local pending writes.- See Also:
-
-
Constructor Details
-
SessionOptions
public SessionOptions()Create a newSessionOptions
instance configured with default configuration settings. -
SessionOptions
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 Details
-
clone
-
copyInto
Copy all options from thisSessionOptions
instance into the instance provided.- Parameters:
other
- the target of this copy operation.- Returns:
- the
SessionOptions
instance that was given.
-
closeTimeout
public long closeTimeout()- Returns:
- the timeout used when awaiting a response from the remote when a resource is closed.
-
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
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
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
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
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
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
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
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
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
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
- Returns:
- the offeredCapabilities
-
offeredCapabilities
- Parameters:
offeredCapabilities
- the offeredCapabilities to set- Returns:
- this
SessionOptions
instance.
-
desiredCapabilities
- Returns:
- the desiredCapabilities
-
desiredCapabilities
- Parameters:
desiredCapabilities
- the desiredCapabilities to set- Returns:
- this
SessionOptions
instance.
-
properties
- Returns:
- the properties
-
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
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
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.
-
defaultNextReceiverPolicy
- Returns:
- the configured default next receiver policy for a session created using these options.
-
defaultNextReceiverPolicy
Configures the default next receiver policy for the session created with these configuration options.- Parameters:
policy
- The default next receiver policy to assign to a new session.- Returns:
- this
SessionOptions
instance.
-