InMemoryInboxStorage

public final class InMemoryInboxStorage extends AbstractStorage<I, M, R> implements InboxStorage

In-memory implementation of messages stored in Inbox.

Mutating operations are made synchronized to avoid simultaneous updates of the same records. That allows to operate in a concurrency-heavy environment notwithstanding the thread-safety of the underlying storage.

Constructors

Link copied to clipboard
public void InMemoryInboxStorage(boolean multitenant)

Functions

Link copied to clipboard
public Iterator<InboxMessageId> index()
Returns an iterator over identifiers of records in the storage.
Link copied to clipboard
public Optional<InboxMessage> newestMessageToDeliver(ShardIndex index)
Finds the newest message to deliver in the given shard.
Link copied to clipboard
public Optional<InboxMessage> read(InboxReadRequest request)
Reads a record from the storage by the specified request.
Link copied to clipboard
public Page<InboxMessage> readAll(ShardIndex index, int pageSize)
Reads the contents of the storage by the given shard index and returns the first page of the results.
Link copied to clipboard
public synchronized void removeAll(Iterable<InboxMessage> messages)
Removes the passed messages from the storage.
Link copied to clipboard
public synchronized void write(InboxMessage message)
Writes a message to the storage.
public synchronized void write(InboxMessageId id, InboxMessage record)
Writes a record into the storage.
Link copied to clipboard
public synchronized void writeAll(Iterable<InboxMessage> messages)
Writes several messages to the storage.

Inherited functions

Link copied to clipboard
protected void checkNotClosed()
protected void checkNotClosed(String message)
Ensures the storage is not closed.
Link copied to clipboard
public void close()
Closes the storage.
public abstract void close()
Link copied to clipboard
public boolean isClosed()
Tests whether the storage is closed.
Link copied to clipboard
public boolean isMultitenant()
Verifies whether the storage is multitenant.
Link copied to clipboard
public boolean isOpen()
Tests whether the storage is open.