public interface QueuePersistor<T> extends 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(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.
|
Long |
offer(T t)
Persist and return the last Long id of the item.
|
Long |
offerAll(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.
|
forEach, iterator, spliterator
long lastId()
long size()
boolean hasNext()
true
if items can be retrieved from this persistor, false
otherwiseLong offer(@Nonnull T t)
t
- element to persistLong offerAll(@Nonnull Collection<T> t)
t
- element to persistT get(Long idx)
idx
- the given index to lookupT remove()
void close()
Copyright © 2017. All rights reserved.