public class InMemoryQueuePersistor<T> extends java.lang.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.
|
Function<java.lang.Long,T> |
get()
Returns a
Function that will return the item with the given id. |
boolean |
hasNext()
Are there more items waiting to be returned?
|
java.util.Iterator<T> |
iterator() |
long |
lastId()
Get the value of the last item to have been persisted.
|
Function<T,java.lang.Long> |
offer()
Returns a
Function that will persist the item and return a Long id for the item. |
Supplier<T> |
remove()
Returns a
Supplier that will simply remove the oldest item from the persistence queue. |
long |
size()
Get the number of items persisted right now.
|
public 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 java.util.Iterator<T> iterator()
iterator in interface java.lang.Iterable<T>@Nonnull public Function<T,java.lang.Long> offer()
QueuePersistorFunction that will persist the item and return a Long id for the item.offer in interface QueuePersistor<T>@Nonnull public Function<java.lang.Long,T> get()
QueuePersistorFunction that will return the item with the given id.get in interface QueuePersistor<T>@Nonnull public Supplier<T> remove()
QueuePersistorSupplier that will simply remove the oldest item from the persistence queue.remove in interface QueuePersistor<T>public void close()
QueuePersistorclose in interface QueuePersistor<T>