public interface QueuePersistor<T>
extends java.lang.Iterable<T>
PersistentQueue
.
Persistence could be achieved through in-memory solutions like a Map
or could be more complex and
use a backing datastore.Modifier and Type | Method and Description |
---|---|
void |
close()
Release any internal resources used by the persistence mechanism.
|
T |
get(java.lang.Long idx)
Return the item with the given id.
|
boolean |
hasNext()
Are there more items waiting to be returned?
|
long |
lastId()
Get the value of the last item to have been persisted.
|
java.lang.Long |
offer(T t)
Persist and return the last Long id of the item.
|
java.lang.Long |
offerAll(java.util.Collection<T> t)
Persist N items in batch and return a Long id of the last item.
|
T |
remove()
Remove the oldest item from the persistence queue.
|
long |
size()
Get the number of items persisted right now.
|
long lastId()
long size()
boolean hasNext()
true
if items can be retrieved from this persistor, false
otherwisejava.lang.Long offer(@Nonnull T t)
t
- element to persistjava.lang.Long offerAll(@Nonnull java.util.Collection<T> t)
t
- element to persistT get(java.lang.Long idx)
idx
- the given index to lookupT remove()
void close()