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
FieldsModifier and TypeFieldDescriptionstatic final intThe default Session configured incoming capacity limit to provide to the remotestatic final intThe default Session configured outgoing capacity to apply to local pending writes. -
Constructor Summary
ConstructorsConstructorDescriptionCreate 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
Modifier and TypeMethodDescriptionclone()longcloseTimeout(long closeTimeout) Configures the timeout used when awaiting a response from the remote that a request to close aSessionas been honored.closeTimeout(long timeout, TimeUnit units) protected SessionOptionscopyInto(SessionOptions other) Copy all options from thisSessionOptionsinstance into the instance provided.Configures the default next receiver policy for the session created with these configuration options.String[]desiredCapabilities(String... desiredCapabilities) longdrainTimeout(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.drainTimeout(long timeout, 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(int incomingCapacity) Sets the incoming capacity for aSessioncreated with these options.String[]offeredCapabilities(String... offeredCapabilities) longopenTimeout(long openTimeout) Configures the timeout used when awaiting a response from the remote that a request to open aSessionhas been honored.openTimeout(long timeout, TimeUnit units) intoutgoingCapacity(int outgoingCapacity) Sets the outgoing capacity for aSessioncreated with these options.properties(Map<String, Object> properties) longrequestTimeout(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.longsendTimeout(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 newSessionOptionsinstance 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 thisSessionOptionsinstance into the instance provided.- Parameters:
other- the target of this copy operation.- Returns:
- the
SessionOptionsinstance 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 aSessionas been honored.- Parameters:
closeTimeout- Timeout value in milliseconds to wait for a remote response.- Returns:
- this
SessionOptionsinstance.
-
closeTimeout
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
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
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
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
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
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
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
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
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
- Returns:
- the offeredCapabilities
-
offeredCapabilities
- Parameters:
offeredCapabilities- the offeredCapabilities to set- Returns:
- this
SessionOptionsinstance.
-
desiredCapabilities
- Returns:
- the desiredCapabilities
-
desiredCapabilities
- Parameters:
desiredCapabilities- the desiredCapabilities to set- Returns:
- this
SessionOptionsinstance.
-
properties
- Returns:
- the properties
-
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
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
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.
-
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
SessionOptionsinstance.
-