public class InMemoryQueuePersistor<T> extends Object implements QueuePersistor<T>
QueuePersistor implementations that stores items in-memory.| Constructor and Description |
|---|
InMemoryQueuePersistor() |
| 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?
|
Iterator<T> |
iterator() |
long |
lastId()
Get the value of the last item to have been persisted.
|
Long |
offer(T obj)
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.
|
Map<Long,T> |
refMap() |
T |
remove()
Remove the oldest item from the persistence queue.
|
long |
size()
Get the number of items persisted right now.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic long lastId()
QueuePersistorlastId in interface QueuePersistor<T>public long size()
QueuePersistorsize in interface QueuePersistor<T>public boolean hasNext()
QueuePersistorhasNext in interface QueuePersistor<T>true if items can be retrieved from this persistor, false otherwisepublic Long offer(@Nonnull T obj)
QueuePersistoroffer in interface QueuePersistor<T>obj - element to persistpublic Long offerAll(@Nonnull Collection<T> t)
QueuePersistorofferAll in interface QueuePersistor<T>t - element to persistpublic T get(Long idx)
QueuePersistorget in interface QueuePersistor<T>idx - the given index to lookuppublic T remove()
QueuePersistorremove in interface QueuePersistor<T>public void close()
QueuePersistorclose in interface QueuePersistor<T>Copyright © 2016. All rights reserved.