public class MessageGroupQueue extends AbstractQueue<Message<?>> implements BlockingQueue<Message<?>>
BlockingQueue that is backed by a MessageGroupStore. Can be used to ensure guaranteed delivery in
the face of transaction rollback (assuming the store is transactional) and also to ensure messages are not lost if
the process dies (assuming the store is durable). To use the queue across process re-starts, the same group id
must be provided, so it needs to be unique but identifiable with a single logical instance of the queue.| Constructor and Description |
|---|
MessageGroupQueue(MessageGroupStore messageGroupStore,
Object groupId) |
MessageGroupQueue(MessageGroupStore messageGroupStore,
Object groupId,
int capacity) |
MessageGroupQueue(MessageGroupStore messageGroupStore,
Object groupId,
int capacity,
Lock storeLock) |
MessageGroupQueue(MessageGroupStore messageGroupStore,
Object groupId,
Lock storeLock) |
| Modifier and Type | Method and Description |
|---|---|
int |
drainTo(Collection<? super Message<?>> c) |
int |
drainTo(Collection<? super Message<?>> collection,
int maxElements) |
Iterator<Message<?>> |
iterator() |
boolean |
offer(Message<?> message) |
boolean |
offer(Message<?> message,
long timeout,
TimeUnit unit) |
Message<?> |
peek() |
Message<?> |
poll() |
Message<?> |
poll(long timeout,
TimeUnit unit) |
void |
put(Message<?> message) |
int |
remainingCapacity() |
int |
size() |
Message<?> |
take() |
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadd, contains, removeaddAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArraypublic MessageGroupQueue(MessageGroupStore messageGroupStore, Object groupId)
public MessageGroupQueue(MessageGroupStore messageGroupStore, Object groupId, int capacity)
public MessageGroupQueue(MessageGroupStore messageGroupStore, Object groupId, Lock storeLock)
public MessageGroupQueue(MessageGroupStore messageGroupStore, Object groupId, int capacity, Lock storeLock)
public Iterator<Message<?>> iterator()
iterator in interface Iterable<Message<?>>iterator in interface Collection<Message<?>>iterator in class AbstractCollection<Message<?>>public int size()
size in interface Collection<Message<?>>size in class AbstractCollection<Message<?>>public Message<?> poll(long timeout, TimeUnit unit) throws InterruptedException
poll in interface BlockingQueue<Message<?>>InterruptedExceptionpublic int drainTo(Collection<? super Message<?>> c)
drainTo in interface BlockingQueue<Message<?>>public int drainTo(Collection<? super Message<?>> collection, int maxElements)
drainTo in interface BlockingQueue<Message<?>>public boolean offer(Message<?> message)
public boolean offer(Message<?> message, long timeout, TimeUnit unit) throws InterruptedException
offer in interface BlockingQueue<Message<?>>InterruptedExceptionpublic void put(Message<?> message) throws InterruptedException
put in interface BlockingQueue<Message<?>>InterruptedExceptionpublic int remainingCapacity()
remainingCapacity in interface BlockingQueue<Message<?>>public Message<?> take() throws InterruptedException
take in interface BlockingQueue<Message<?>>InterruptedExceptionCopyright © 2016. All rights reserved.