summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/funcutils/LambdaLock.java
diff options
context:
space:
mode:
Diffstat (limited to 'base/src/main/java/bjc/utils/funcutils/LambdaLock.java')
-rw-r--r--base/src/main/java/bjc/utils/funcutils/LambdaLock.java25
1 files changed, 8 insertions, 17 deletions
diff --git a/base/src/main/java/bjc/utils/funcutils/LambdaLock.java b/base/src/main/java/bjc/utils/funcutils/LambdaLock.java
index c7ba09a..c974c8c 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,26 +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 <T> The type returned by the action.
*
* @param supp The action to call.
*
- * @return The result of the action.
- */
+ * @return The result of the action. */
public <T> T read(final Supplier<T> supp) {
readLock.lock();
@@ -59,8 +52,7 @@ public class LambdaLock {
*
* @param supp The action to call.
*
- * @return The result of the action.
- */
+ * @return The result of the action. */
public <T> T write(final Supplier<T> supp) {
writeLock.lock();
@@ -74,8 +66,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();