public interface Queue<T extends Queueable>
Modifier and Type | Method and Description |
---|---|
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.
|
default void |
clearOutOfTurn(Consumer<T> elementConsumer)
Removes the elements which were added by
addOutOfTurn . |
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.
|
Queueable[] |
toArray()
Return all objects in the queue as array.
|
int |
totalSize()
Returns current total queue size.
|
void initialize()
boolean add(T element)
element
- the elementboolean addOutOfTurn(T element)
element
- the elementvoid setOutOfTurnOnlyMode(boolean mode)
mode
- the modedefault void clearOutOfTurn(Consumer<T> elementConsumer)
addOutOfTurn
.elementConsumer
- callback for each removed message. It is called after removing next message.boolean isAllEmpty()
T poll()
commit()
void commit()
IllegalStateException
boolean isEmpty()
int size()
int totalSize()
void clear()
void shutdown()
boolean isOutOfTurnOnlyMode()
void notifyAllApplication()
The methods works only if turn "mode on" is off.
setOutOfTurnOnlyMode(boolean)
void notifyAllSession()
Queueable[] toArray()
Copyright © 2000–2022 EPAM Systems. All rights reserved.