Use names that reflect the functional interface in use.

This commit is contained in:
Gary Gregory 2020-06-18 12:36:00 -04:00
parent d22f4e1e61
commit f05c39b6e4
1 changed files with 6 additions and 6 deletions

View File

@ -78,22 +78,22 @@ public class Locks {
} }
public void runReadLocked(FailableConsumer<O, ?> consumer) { public void runReadLocked(FailableConsumer<O, ?> consumer) {
runLocked(lock.readLock(), consumer); acceptLocked(lock.readLock(), consumer);
} }
public void runWriteLocked(FailableConsumer<O, ?> consumer) { public void runWriteLocked(FailableConsumer<O, ?> consumer) {
runLocked(lock.writeLock(), consumer); acceptLocked(lock.writeLock(), consumer);
} }
public <T> T callReadLocked(FailableFunction<O, T, ?> function) { public <T> T callReadLocked(FailableFunction<O, T, ?> function) {
return callLocked(lock.readLock(), function); return applyLocked(lock.readLock(), function);
} }
public <T> T callWriteLocked(FailableFunction<O, T, ?> function) { public <T> T callWriteLocked(FailableFunction<O, T, ?> function) {
return callLocked(lock.writeLock(), function); return applyLocked(lock.writeLock(), function);
} }
protected void runLocked(long stamp, FailableConsumer<O, ?> consumer) { protected void acceptLocked(long stamp, FailableConsumer<O, ?> consumer) {
try { try {
consumer.accept(lockedObject); consumer.accept(lockedObject);
} catch (Throwable t) { } catch (Throwable t) {
@ -103,7 +103,7 @@ public class Locks {
} }
} }
protected <T> T callLocked(long stamp, FailableFunction<O, T, ?> function) { protected <T> T applyLocked(long stamp, FailableFunction<O, T, ?> function) {
try { try {
return function.apply(lockedObject); return function.apply(lockedObject);
} catch (Throwable t) { } catch (Throwable t) {