diff --git a/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/FileLockNamedLock.java b/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/FileLockNamedLock.java index c3589adc2..b584805e1 100644 --- a/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/FileLockNamedLock.java +++ b/maven-resolver-named-locks/src/main/java/org/eclipse/aether/named/support/FileLockNamedLock.java @@ -87,16 +87,16 @@ public FileLockNamedLock( @Override protected boolean doLockShared(final long time, final TimeUnit unit) throws InterruptedException { - return retry(time, unit, RETRY_SLEEP_MILLIS, this::doLockShared, null, false); + return retry(time, unit, RETRY_SLEEP_MILLIS, () -> doLockSharedPerform(time, unit), null, false); } @Override protected boolean doLockExclusively(final long time, final TimeUnit unit) throws InterruptedException { - return retry(time, unit, RETRY_SLEEP_MILLIS, this::doLockExclusively, null, false); + return retry(time, unit, RETRY_SLEEP_MILLIS, () -> doLockExclusivelyPerform(time, unit), null, false); } - private Boolean doLockShared() { - if (criticalRegion.tryLock()) { + private Boolean doLockSharedPerform(final long time, final TimeUnit unit) throws InterruptedException { + if (criticalRegion.tryLock(time, unit)) { try { Deque steps = threadSteps.computeIfAbsent(Thread.currentThread(), k -> new ArrayDeque<>()); FileLock obtainedLock = fileLockRef.get(); @@ -130,8 +130,8 @@ private Boolean doLockShared() { return null; } - private Boolean doLockExclusively() { - if (criticalRegion.tryLock()) { + private Boolean doLockExclusivelyPerform(final long time, final TimeUnit unit) throws InterruptedException { + if (criticalRegion.tryLock(time, unit)) { try { Deque steps = threadSteps.computeIfAbsent(Thread.currentThread(), k -> new ArrayDeque<>()); FileLock obtainedLock = fileLockRef.get();