Package COM.activesw.api.client
Class BrokerClientPoll
- java.lang.Object
-
- COM.activesw.api.client.BrokerClientPoll
-
public class BrokerClientPoll extends java.lang.Object
This class is a data structure used to describe client poll information.
-
-
Field Summary
Fields Modifier and Type Field Description static int
GET_EVENTS
Operation bit for "get events".
-
Constructor Summary
Constructors Constructor Description BrokerClientPoll(BrokerClient client, int requested, java.lang.Object data)
Create a client poll object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BrokerClient
getBrokerClient()
Get the Broker client.java.lang.Object
getData()
Get user data.int
getReady()
Get the poll's ready operations.int
getRequested()
Get the poll's requested operations.boolean
getSuspend()
Get the suspend state of this poll object.boolean
isReady(int operations)
Check if operations are ready.boolean
isRequested(int operations)
Check if operations are requested.void
setBrokerClient(BrokerClient client)
Set the Broker client.java.lang.Object
setData(java.lang.Object data)
Set user data.protected void
setReady(int ready)
Set the poll's ready operations.protected void
setRequested(int requested)
Set the poll's requested operations.void
setSuspend(boolean suspend)
Suspend or unsuspend this poll object.
-
-
-
Field Detail
-
GET_EVENTS
public static final int GET_EVENTS
Operation bit for "get events".This operation is ready when BrokerClient.isClientPending() returns true from within BrokerClient.poll().
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BrokerClientPoll
public BrokerClientPoll(BrokerClient client, int requested, java.lang.Object data) throws BrokerException
Create a client poll object. The client poll object is passed to BrokerClient.poll() and returned when any of the requested operations are ready.Note: Calling BrokerClient.poll on the same BrokerClientPoll object in multiple threads is not supported.
- Parameters:
client
- The client to poll.requested
- The requested operations.data
- The user data; may be null.- Throws:
BrokerNullParameterException
- If client is null.BrokerInvalidPollOperationException
- if a requested operation is invalid.BrokerException
-
-
Method Detail
-
getBrokerClient
public BrokerClient getBrokerClient()
Get the Broker client.- Returns:
- The Broker client.
-
setBrokerClient
public void setBrokerClient(BrokerClient client) throws BrokerException
Set the Broker client. The BrokerClientPoll object must be suspended in order to set the Broker client.- Parameters:
client
- The Broker client.- Throws:
BrokerNullParameterException
- If client is null.BrokerException
-
getRequested
public int getRequested()
Get the poll's requested operations.- Returns:
- The requested operations.
-
setRequested
protected void setRequested(int requested) throws BrokerException
Set the poll's requested operations.- Parameters:
requested
- The requested operations.- Throws:
BrokerInvalidPollOperationException
- if a requested operation is invalid.BrokerException
-
isRequested
public boolean isRequested(int operations) throws BrokerException
Check if operations are requested.- Parameters:
operations
- The operation(s) to check.- Returns:
- true if the operation is requested.
- Throws:
BrokerInvalidPollOperationException
- if a requested operation is invalid.BrokerException
-
getReady
public int getReady()
Get the poll's ready operations.- Returns:
- The ready operations.
-
setReady
protected void setReady(int ready) throws BrokerException
Set the poll's ready operations.- Parameters:
ready
- The ready operations.- Throws:
BrokerInvalidPollOperationException
- if a requested operation is invalid.BrokerException
-
isReady
public boolean isReady(int operations) throws BrokerException
Check if operations are ready.- Parameters:
operations
- The operation(s) to check.- Returns:
- true if the operation is requested.
- Throws:
BrokerInvalidPollOperationException
- if a requested operation is invalid.BrokerException
-
setData
public java.lang.Object setData(java.lang.Object data)
Set user data.- Parameters:
data
- The user data; may be null.- Returns:
- The old user data, if any, or null.
-
getData
public java.lang.Object getData()
Get user data.- Returns:
- The user data, if any, or null.
-
setSuspend
public void setSuspend(boolean suspend)
Suspend or unsuspend this poll object. When suspended this poll object will not be polled when passed to BrokerClient.poll.- Parameters:
suspend
-true
to temporarily suspend polling of this object,false
to resume polling.
-
getSuspend
public boolean getSuspend()
Get the suspend state of this poll object.- Returns:
true
if this poll object is suspended.
-
-