AbstractWorkRegistry

public abstract class AbstractWorkRegistry implements ShardedWorkRegistry

An implementation base for ShardedWorkRegistries based on a specific persistence mechanism.

Inheritors

Constructors

Link copied to clipboard
public void AbstractWorkRegistry()

Functions

Link copied to clipboard
protected abstract Iterator<ShardSessionRecord> allRecords()
Obtains all the session records associated with this registry.
Link copied to clipboard
protected void clearNode(ShardSessionRecord session)
Clears the value of ShardSessionRecord.worker and stores the session.
Link copied to clipboard
protected abstract WorkerId currentWorkerFor(NodeId node)
Returns an identifier of the current worker that is now going to process the shard.
Link copied to clipboard
protected abstract Optional<ShardSessionRecord> find(ShardIndex index)
Looks for the session record by the given shard index.
Link copied to clipboard
public PickUpOutcome pickUp(ShardIndex index, NodeId node)
Picks up the shard at a given index to process.
Link copied to clipboard
public 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 abstract void write(ShardSessionRecord session)
Stores the given session.

Inherited functions

Link copied to clipboard
public abstract void release(ShardSessionRecord session)
Completes the given session and releases the picked up shard, making it available for picking up.