From 889fac2bdf993dc86f64a8893c0260fdcf848acb Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Mon, 10 Apr 2017 16:40:33 -0400 Subject: Cleanup --- .../main/java/bjc/utils/funcutils/LambdaLock.java | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcutils/LambdaLock.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcutils/LambdaLock.java b/BJC-Utils2/src/main/java/bjc/utils/funcutils/LambdaLock.java index 23745d8..62c5d32 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcutils/LambdaLock.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcutils/LambdaLock.java @@ -8,13 +8,13 @@ import java.util.function.Supplier; /** * A wrapper around a {@link ReadWriteLock} to ensure that the lock is used * properly. - * + * * @author EVE * */ public class LambdaLock { - private Lock readLock; - private Lock writeLock; + private final Lock readLock; + private final Lock writeLock; /** * Create a new lambda-enabled lock around a new lock. @@ -25,24 +25,24 @@ public class LambdaLock { /** * Create a new lambda-enabled lock. - * + * * @param lck * The lock to wrap. */ - public LambdaLock(ReadWriteLock lck) { + public LambdaLock(final ReadWriteLock lck) { readLock = lck.readLock(); writeLock = lck.writeLock(); } /** * Execute an action with the read lock taken. - * + * * @param supp * The action to call. - * + * * @return The result of the action. */ - public T read(Supplier supp) { + public T read(final Supplier supp) { readLock.lock(); try { @@ -54,13 +54,13 @@ public class LambdaLock { /** * Execute an action with the write lock taken. - * + * * @param supp * The action to call. - * + * * @return The result of the action. */ - public T write(Supplier supp) { + public T write(final Supplier supp) { writeLock.lock(); try { @@ -72,12 +72,12 @@ public class LambdaLock { /** * Execute an action with the read lock taken. - * + * * @param action * The action to call. - * + * */ - public void read(Runnable action) { + public void read(final Runnable action) { readLock.lock(); try { @@ -89,11 +89,11 @@ public class LambdaLock { /** * Execute an action with the write lock taken. - * + * * @param action * The action to call. */ - public void write(Runnable action) { + public void write(final Runnable action) { writeLock.lock(); try { -- cgit v1.2.3