com.epam.fixengine.storage.queue
Interface Queue<T extends Queueable>


public interface Queue<T extends Queueable>

Queue interface.


Method Summary
 boolean add(T element)
          Add object to the queue.
 boolean addOutOfTurn(T element)
          Add object to the queue out of turn.
 void clear()
          Clears the queue.
 void commit()
          Removes polled object from the queue.
 void initialize()
          Initializes queue.
 boolean isAllEmpty()
           
 boolean isEmpty()
          Checks if queue is currently empty.
 boolean isOutOfTurnOnlyMode()
          Out of turn messages only mode.
 void notifyAllApplication()
          Notify a new application message exists.
 void notifyAllSession()
          Notify a new session message exists.
 T poll()
          Poll object from the queue (doesn't remove it from queue yet!).
 void setOutOfTurnOnlyMode(boolean mode)
          Out of turn messages only mode.
 void shutdown()
          Gracefully shutdowns queue.
 int size()
          Returns current queue size.
 int totalSize()
          Returns current total queue size.
 

Method Detail

initialize

void initialize()
Initializes queue. That includes restore of previously
saved queue content for persistent queues.


add

boolean add(T element)
Add object to the queue.

Parameters:
element - the element
Returns:
true if element added successfully.

addOutOfTurn

boolean addOutOfTurn(T element)
Add object to the queue out of turn.

Parameters:
element - the element
Returns:
true if element added successfully.

setOutOfTurnOnlyMode

void setOutOfTurnOnlyMode(boolean mode)
Out of turn messages only mode.

Parameters:
mode - the mode

isAllEmpty

boolean isAllEmpty()

poll

T poll()
Poll object from the queue (doesn't remove it from queue yet!).

Returns:
the head of this queue, or null if this queue is empty
See Also:
commit()

commit

void commit()
Removes polled object from the queue.
If nothing was polled - throws IllegalStateException

See Also:
IllegalStateException

isEmpty

boolean isEmpty()
Checks if queue is currently empty.

Returns:
true if empty

size

int size()
Returns current queue size.

Returns:
queue size

totalSize

int totalSize()
Returns current total queue size. The total size of the usual queue and the OutOfTurn queue.

Returns:
queue size

clear

void clear()
Clears the queue.


shutdown

void shutdown()
Gracefully shutdowns queue.


isOutOfTurnOnlyMode

boolean isOutOfTurnOnlyMode()
Out of turn messages only mode.


notifyAllApplication

void notifyAllApplication()
Notify a new application message exists.

The methods works only if turn "mode on" is off.

See Also:
setOutOfTurnOnlyMode(boolean)

notifyAllSession

void notifyAllSession()
Notify a new session message exists.



Copyright © 2000-2014 EPAM Systems. All Rights Reserved.