public final class DefaultMessageQueue extends java.lang.Object implements MessageQueue
We also count on writers not to call the isEmpty() method
Modifier and Type | Field and Description |
---|---|
private boolean |
empty |
private java.util.LinkedList<java.lang.Object> |
inside |
private java.util.LinkedList<java.lang.Object> |
outside |
Constructor and Description |
---|
DefaultMessageQueue() |
private java.util.LinkedList<java.lang.Object> outside
private java.util.LinkedList<java.lang.Object> inside
private volatile boolean empty
public boolean isEmpty()
isEmpty
in interface MessageQueue
public java.lang.Object poll()
poll
in interface MessageQueue
private void swap(java.util.LinkedList<java.lang.Object> localQueue)
public void add(java.lang.Object element)
add
in interface MessageQueue