InMemoryShardedWorkRegistry

An in-memory implementation of ShardedWorkRegistry.

Constructors

Link copied to clipboard

Functions

Link copied to clipboard
protected Iterator<ShardSessionRecord> allRecords()
Obtains all the session records associated with this registry.
Link copied to clipboard
protected synchronized void clearNode(ShardSessionRecord session)
Clears the value of ShardSessionRecord.worker and stores the session.
Link copied to clipboard
protected WorkerId currentWorkerFor(NodeId node)
Returns an identifier of the current worker that is now going to process the shard.
Link copied to clipboard
protected Optional<ShardSessionRecord> find(ShardIndex index)
Looks for the session record by the given shard index.
Link copied to clipboard
public synchronized PickUpOutcome pickUp(ShardIndex index, NodeId nodeId)
Picks up the shard at a given index to process.
Link copied to clipboard
public void release(ShardSessionRecord session)
Completes the given session and releases the picked up shard, making it available for picking up.
Link copied to clipboard
public synchronized Iterable<ShardIndex> releaseExpiredSessions(Duration inactivityPeriod)
Clears up the recorded NodeIds from the session records if there was no activity for longer than passed inactivityPeriod.
Link copied to clipboard
protected void write(ShardSessionRecord session)
Stores the given session.