public class ConditionalBoundedMessageQueue extends Object implements Iterable<JCSMPXMLMessage>
| Constructor and Description |
|---|
ConditionalBoundedMessageQueue(int capacity,
boolean fair,
Callable<?> onEnqueueOnFull)
Creates an ArrayBlockingQueue with the given (fixed)
capacity and the specified access policy.
|
ConditionalBoundedMessageQueue(int capacity,
Callable<?> onEnqueueOnFull)
Creates an ArrayBlockingQueue with the given (fixed)
capacity and default access policy.
|
| Modifier and Type | Method and Description |
|---|---|
void |
activate() |
void |
clear()
Atomically removes all of the elements from this queue.
|
boolean |
contains(Object o) |
int |
copyTo(Collection<JCSMPXMLMessage> c) |
void |
deactivate() |
int |
drainTo(Collection<JCSMPXMLMessage> c) |
int |
drainTo(Collection<JCSMPXMLMessage> c,
int maxElements) |
boolean |
isEmpty() |
boolean |
isFull() |
Iterator<JCSMPXMLMessage> |
iterator()
Returns an iterator over the elements in this queue in proper sequence.
|
int |
msgIdRenumbering(long lastMsgIdSent) |
JCSMPXMLMessage |
peek() |
JCSMPXMLMessage |
poll() |
int |
processElements(ProcessElementsTask task) |
void |
queueMsgWithIdUpdate(JCSMPXMLMessage o,
PubADManager adMgr)
updates message ID of the specified message before adds it to the tail of this queue, waiting if
necessary for space to become available or the queue is resumed.
|
int |
remainingCapacity()
Returns the number of elements that this queue can ideally (in
the absence of memory or resource constraints) accept without
blocking.
|
boolean |
remove(Object o)
Removes a single instance of the specified element from this
queue, if it is present.
|
void |
resume() |
int |
size()
Returns the number of elements in this queue.
|
void |
suspend() |
JCSMPXMLMessage |
take() |
Object[] |
toArray() |
JCSMPXMLMessage[] |
toArray(JCSMPXMLMessage[] a) |
String |
toString() |
void |
waitUntilEmpty() |
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic ConditionalBoundedMessageQueue(int capacity,
Callable<?> onEnqueueOnFull)
capacity - the capacity of this queueIllegalArgumentException - if capacity is less than 1public ConditionalBoundedMessageQueue(int capacity,
boolean fair,
Callable<?> onEnqueueOnFull)
capacity - the capacity of this queuefair - if true then queue accesses for threads blocked
on insertion or removal, are processed in FIFO order; if false
the access order is unspecified.IllegalArgumentException - if capacity is less than 1public JCSMPXMLMessage poll()
public boolean remove(Object o)
public JCSMPXMLMessage peek()
public JCSMPXMLMessage take() throws InterruptedException
InterruptedExceptionpublic void queueMsgWithIdUpdate(JCSMPXMLMessage o, PubADManager adMgr) throws InterruptedException, InvalidOperationException
o - the element to addInterruptedException - if interrupted while waiting.NullPointerException - if the specified element is null.InvalidOperationExceptionpublic int size()
public boolean isEmpty()
public boolean isFull()
public int remainingCapacity()
Note that you cannot always tell if an attempt to add an element will succeed by inspecting remainingCapacity because it may be the case that a waiting consumer is ready to take an element out of an otherwise full queue.
public boolean contains(Object o)
public Object[] toArray()
public JCSMPXMLMessage[] toArray(JCSMPXMLMessage[] a)
public void clear()
public int drainTo(Collection<JCSMPXMLMessage> c)
public int drainTo(Collection<JCSMPXMLMessage> c, int maxElements)
public int copyTo(Collection<JCSMPXMLMessage> c)
public int msgIdRenumbering(long lastMsgIdSent)
public void suspend()
public void resume()
public int processElements(ProcessElementsTask task) throws JCSMPException
JCSMPExceptionpublic void deactivate()
public void activate()
public void waitUntilEmpty()
throws InterruptedException
InterruptedExceptionpublic Iterator<JCSMPXMLMessage> iterator()
ConcurrentModificationException,
and guarantees to traverse elements as they existed upon
construction of the iterator, and may (but is not guaranteed to)
reflect any modifications subsequent to construction.iterator in interface Iterable<JCSMPXMLMessage>Copyright 2004-2020 Solace Corporation. All rights reserved.