public class PersistentQueue<T> extends AbstractQueue<T> implements CompletableQueue<T>
Queue
implementation that delegates the actual storage of the
elements in the queue to a QueuePersistor
.Constructor and Description |
---|
PersistentQueue(QueuePersistor<T> persistor)
Create a PersistentQueue using the given
QueuePersistor . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the underlying
QueuePersistor and release any resources. |
void |
complete()
Mark this queue as complete
|
boolean |
isComplete()
Get the number of items persisted right now.
|
Iterator<T> |
iterator() |
boolean |
offer(T obj) |
T |
peek() |
T |
poll() |
int |
size() |
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray
public PersistentQueue(@Nullable QueuePersistor<T> persistor)
QueuePersistor
.persistor
- public void close()
QueuePersistor
and release any resources.@Nonnull public Iterator<T> iterator()
iterator
in interface Iterable<T>
iterator
in interface Collection<T>
iterator
in class AbstractCollection<T>
public int size()
size
in interface Collection<T>
size
in class AbstractCollection<T>
public void complete()
CompletableQueue
complete
in interface CompletableQueue<T>
public boolean isComplete()
CompletableQueue
isComplete
in interface CompletableQueue<T>
this#complete()
Copyright © 2016. All rights reserved.