Package org.apache.qpid.protonj2.client
Enum NextReceiverPolicy
- All Implemented Interfaces:
Serializable
,Comparable<NextReceiverPolicy>
Determines the behavior of a Session when the next receiver method is called
on that session. Each policy provides a contract on the ordering of returned
receivers from the next receiver API when there are receivers with locally
queued deliveries. When there are no
Receiver
instances that have
locally queued deliveries the next receive API will return the next receiver
to receive a complete incoming delivery unless a timeout was given and that
time period expires in which case it will return null
.
Should the user perform receive calls on a Receiver
directly in multiple
threads the behavior of the next receiver API is undefined and it becomes possible
that the resulting receiver returned from that API will have no actual pending
deliveries due to a race. In most cases the caller can mitigate some risk by using
the Receiver.tryReceive()
API and accounting for a null result.
-
Enum Constant Summary
Enum ConstantDescriptionExamines the list of currently open receivers in the session and returns the first receiver found with an available delivery.Examines the list of currently open receivers in the session and returns the receiver with the largest backlog of available deliveries.Examines the list of currently open receivers in the session and returns a random selection from the set of receivers that have a pending delivery immediately available.Examines the list of currently open receivers in the session and returns the next receiver that has a pending delivery that follows the previously returned receiver (if any) otherwise the first receiver in the session with a pending delivery is returned.Examines the list of currently open receivers in the session and returns the receiver with the smallest backlog of available deliveries. -
Method Summary
Modifier and TypeMethodDescriptionstatic NextReceiverPolicy
Returns the enum constant of this type with the specified name.static NextReceiverPolicy[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
ROUND_ROBIN
Examines the list of currently open receivers in the session and returns the next receiver that has a pending delivery that follows the previously returned receiver (if any) otherwise the first receiver in the session with a pending delivery is returned. The order of receivers returned will likely be creation order however the implementation is not required to follow this pattern so the caller should not be coded to rely on that ordering. -
RANDOM
Examines the list of currently open receivers in the session and returns a random selection from the set of receivers that have a pending delivery immediately available. This provides a means of selecting receivers which is not prone to sticking to a highly active receiver which can starve out other receivers which receive only limited traffic. -
FIRST_AVAILABLE
Examines the list of currently open receivers in the session and returns the first receiver found with an available delivery. This can result in starvation if that receiver has a continuous feed of new deliveries from the remote as it will be repeatedly selected by the next receiver API. -
LARGEST_BACKLOG
Examines the list of currently open receivers in the session and returns the receiver with the largest backlog of available deliveries. This can result in starvation if that receiver has a continuous feed of new deliveries from the remote as it will likely be repeatedly selected by the next receiver API. -
SMALLEST_BACKLOG
Examines the list of currently open receivers in the session and returns the receiver with the smallest backlog of available deliveries.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-