Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ public void acquireAndKeepLock(String resource, String lockContext) throws Alrea
}

private void scheduleLock(Lock newLock) {
if (lock != null) {
throw new IllegalStateException("Unable to acquire new lock, already holding lock that would get lost: " + lock);
}
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new lock validation logic should be covered by a test case that verifies the IllegalStateException is thrown when attempting to schedule a lock while already holding one.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot: Please implement a test like that.

lock = newLock;
Duration duration = lockTTL.minusSeconds(30);
if (duration.isNegative() || duration.isZero()) {
Expand Down
Loading