Skip to content

Commit 3738500

Browse files
committed
Fail lock acquisition if service already holds one.
1 parent 5d0cb25 commit 3738500

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

graylog2-server/src/main/java/org/graylog2/cluster/lock/RefreshingLockService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ public void acquireAndKeepLock(String resource, String lockContext) throws Alrea
8585
}
8686

8787
private void scheduleLock(Lock newLock) {
88+
if (lock != null) {
89+
throw new IllegalStateException("Unable to acquire new lock, already holding lock that would get lost: " + lock);
90+
}
8891
lock = newLock;
8992
Duration duration = lockTTL.minusSeconds(30);
9093
if (duration.isNegative() || duration.isZero()) {

0 commit comments

Comments
 (0)