Package at.aimon.session.web.internal
Class HolderLossSweeper
java.lang.Object
at.aimon.session.web.internal.HolderLossSweeper
Periodic sweeper that detects holder loss via the
IdempotencyStore and emits the recovery sequence
required by design §6.3 D / §9.2 stale cleanup.
For every IN_FLIGHT entry whose lastTouchedAt is older than now - secondaryTtl, the sweeper
attempts compareAndReset. The CAS winner — exactly one
across all nodes — performs:
- Emit
InterruptedAt(InterruptReason.HOLDER_LOST) to the localInProcessEventPublisherso on-nodeevents()subscribers see a clean termination. - Complete the local publisher for that conversation.
- Broadcast
ConversationSignal.SignalKind.EVICTso other nodes terminate their publishers identically.
The loop never throws — exceptions are swallowed and logged so a transient backend failure does not kill the scheduled task.
-
Constructor Summary
ConstructorsConstructorDescriptionHolderLossSweeper(IdempotencyStore store, ConversationSignalBus signalBus, InProcessEventPublisher localPublisher, ScheduledExecutorService scheduler, String nodeId, Duration sweepInterval, Duration secondaryTtl) HolderLossSweeper(IdempotencyStore store, ConversationSignalBus signalBus, InProcessEventPublisher localPublisher, ScheduledExecutorService scheduler, String nodeId, Duration sweepInterval, Duration secondaryTtl, SessionMetrics metrics) -
Method Summary
Modifier and TypeMethodDescriptionstart()Schedule periodic sweeps.voidVisible for testing — performs one sweep pass synchronously.
-
Constructor Details
-
HolderLossSweeper
public HolderLossSweeper(IdempotencyStore store, ConversationSignalBus signalBus, InProcessEventPublisher localPublisher, ScheduledExecutorService scheduler, String nodeId, Duration sweepInterval, Duration secondaryTtl) -
HolderLossSweeper
public HolderLossSweeper(IdempotencyStore store, ConversationSignalBus signalBus, InProcessEventPublisher localPublisher, ScheduledExecutorService scheduler, String nodeId, Duration sweepInterval, Duration secondaryTtl, SessionMetrics metrics)
-
-
Method Details
-
start
Schedule periodic sweeps. The returned future is cancellable; the manager cancels it on close.- Returns:
- the scheduled task handle (never null)
-
sweepOnce
public void sweepOnce()Visible for testing — performs one sweep pass synchronously.
-