Class EventQueue
An Request can be associated with an EventQueue by passing a valid instance of the EventQueue
class to the sendRequest
and sendAuthorizationRequest
methods. All responses to the Request are now
delivered to this EventQueue allowing the application to block for Responses for the Request.
Note that a single EventQueue can be used for receiving Response Events for many requests.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves the next event available for processing on this EventQueuenextEvent
(long timeoutMillis) Retrieves the next event available for processing on this EventQueuevoid
purge()
Purge all events from this Event Queue and cancel all Requests that this Event Queue is associated withTries to retrieve the next event available for processing on this EventQueue
-
Constructor Details
-
EventQueue
public EventQueue()Construct an empty event queue.
-
-
Method Details
-
nextEvent
Retrieves the next event available for processing on this EventQueueThis method is the same as calling
nextEvent(0)
- Returns:
- next event available on this session
- Throws:
InterruptedException
- if another thread has interrupted the current thread
-
nextEvent
Retrieves the next event available for processing on this EventQueueretrieve the next event available for processing on this EventQueue. If no event is available immediately wait for
timeoutMillis
milliseconds for an event to arrive. If no event is received before the timeout expires return aEvent.EventType.TIMEOUT
event. If the timeout specified is 0 then wait for an infinite amount of time for an event to be received.- Parameters:
timeoutMillis
- timeout in milliseconds to wait for an event to be available- Returns:
- next event available before timeout or
Event.EventType.TIMEOUT
event if timeout occurs - Throws:
InterruptedException
- if another thread has interrupted the current thread
-
tryNextEvent
Tries to retrieve the next event available for processing on this EventQueueThis method never blocks.
- Returns:
- next event available on this session if available or null if no event is available immediately
-
purge
public void purge()Purge all events from this Event Queue and cancel all Requests that this Event Queue is associated withPurges any Event objects in this EventQueue which have not been processed and cancel any pending requests linked to this EventQueue. The EventQueue can subsequently be re-used for a subsequent request.
-