Class RemoteLockSession
java.lang.Object
org.jenkins.plugins.lockableresources.remote.RemoteLockSession
- All Implemented Interfaces:
Serializable
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
public final class RemoteLockSession
extends Object
implements Serializable
Client-side state machine for a remote
lock(): enqueue the acquire request, short-poll the remote
server for the outcome, heartbeat while the body runs, and release on completion. A serializable
collaborator of the lock() step execution.
The session owns the transport/scheduling state (poll & heartbeat timers, retry budget, the
persisted serverId/lockId/state). Everything that requires the workflow step's own context
- running the lock body, signalling success/failure - is delegated to a RemoteLockSession.Host (implemented by
LockStepExecution). The session is serialized as a field of the step execution, so it survives a
controller restart; the timers are transient and rebuilt by onResume(Host).
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceStep-side integration the session calls back into. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidfail(RemoteLockSession.Host host, Throwable cause) Fails the session (fail-closed; no release) - used by the host when running the body throws.voidCalled by the step's body callback when the lock body finishes - cancel heartbeat and release the lease.voidResumes the session after a controller restart (rebuilds the poll loop or fails closed).booleanstart(RemoteLockSession.Host host) voidstop(RemoteLockSession.Host host, Throwable cause) Aborts an in-flight session (step stopped): cancel timers, best-effort release, fail the context.
-
Constructor Details
-
RemoteLockSession
public RemoteLockSession()
-
-
Method Details
-
getLockId
- Returns:
- the remote lockId once enqueued (used by the step for resume detection); may be
null.
-
getServerId
- Returns:
- the target serverId once the acquire has been enqueued; may be
null.
-
fail
Fails the session (fail-closed; no release) - used by the host when running the body throws. -
start
- Throws:
Exception
-
onBodyFinished
Called by the step's body callback when the lock body finishes - cancel heartbeat and release the lease. -
stop
Aborts an in-flight session (step stopped): cancel timers, best-effort release, fail the context. -
onResume
Resumes the session after a controller restart (rebuilds the poll loop or fails closed).
-