summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/funcutils/LambdaLock.java
diff options
context:
space:
mode:
authorBenjamin J. Culkin <bjculkin@mix.wvu.edu>2021-07-12 15:53:22 -0300
committerBenjamin J. Culkin <bjculkin@mix.wvu.edu>2021-07-12 15:53:22 -0300
commita24c1042499f76ff2d442ae133ef165011a7af4c (patch)
tree1a0bdff895b7dc2bd9e8006fe3b83805c7e56f4f /base/src/main/java/bjc/utils/funcutils/LambdaLock.java
parente55cb9852a106cff26517d7d1e85bc4b149884f3 (diff)
Formatting tweaks
Diffstat (limited to 'base/src/main/java/bjc/utils/funcutils/LambdaLock.java')
-rw-r--r--base/src/main/java/bjc/utils/funcutils/LambdaLock.java38
1 files changed, 15 insertions, 23 deletions
diff --git a/base/src/main/java/bjc/utils/funcutils/LambdaLock.java b/base/src/main/java/bjc/utils/funcutils/LambdaLock.java
index f3637f9..46de182 100644
--- a/base/src/main/java/bjc/utils/funcutils/LambdaLock.java
+++ b/base/src/main/java/bjc/utils/funcutils/LambdaLock.java
@@ -5,12 +5,10 @@ import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.function.Supplier;
-/**
- * A wrapper around a {@link ReadWriteLock} to ensure that the lock is used
+/** A wrapper around a {@link ReadWriteLock} to ensure that the lock is used
* properly.
*
- * @author EVE
- */
+ * @author EVE */
public class LambdaLock {
/* The read lock. */
private final Lock readLock;
@@ -22,25 +20,21 @@ public class LambdaLock {
this(new ReentrantReadWriteLock());
}
- /**
- * Create a new lambda-enabled lock.
+ /** Create a new lambda-enabled lock.
*
- * @param lck
- * The lock to wrap.
- */
+ * @param lck The lock to wrap. */
public LambdaLock(final ReadWriteLock lck) {
readLock = lck.readLock();
writeLock = lck.writeLock();
}
- /**
- * Execute an action with the read lock taken.
+ /** Execute an action with the read lock taken.
*
- * @param supp
- * The action to call.
+ * @param <T> The type of the result.
*
- * @return The result of the action.
- */
+ * @param supp The action to call.
+ *
+ * @return The result of the action. */
public <T> T read(final Supplier<T> supp) {
readLock.lock();
@@ -51,14 +45,13 @@ public class LambdaLock {
}
}
- /**
- * Execute an action with the write lock taken.
+ /** Execute an action with the write lock taken.
*
- * @param supp
- * The action to call.
+ * @param <T> The type of the result.
*
- * @return The result of the action.
- */
+ * @param supp The action to call.
+ *
+ * @return The result of the action. */
public <T> T write(final Supplier<T> supp) {
writeLock.lock();
@@ -72,8 +65,7 @@ public class LambdaLock {
/**
* Execute an action with the read lock taken.
*
- * @param action
- * The action to call.
+ * @param action The action to call.
*/
public void read(final Runnable action) {
readLock.lock();