mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-27 19:24:43 +02:00
Make sure lock is free'd even on error (fixes #3116)
This commit is contained in:
@ -71,11 +71,9 @@ public final class LockRepository {
|
||||
* @param runnable Action to run when the lock is available
|
||||
*/
|
||||
public void useLock(final @NonNull LockKey key, final @NonNull Runnable runnable) {
|
||||
this.useLock(key, lock -> {
|
||||
lock.lock();
|
||||
runnable.run();
|
||||
lock.unlock();
|
||||
});
|
||||
try (LockAccess ignored = lock(key)) {
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user