Added missing Javadoc and tweaked another Javadoc.

This commit is contained in:
Gary Gregory 2020-07-11 17:16:31 -04:00
parent 3e86896c13
commit 5283344927
1 changed files with 25 additions and 2 deletions

View File

@ -82,12 +82,35 @@ public class LockingVisitors {
*/ */
public static class LockVisitor<O, L> { public static class LockVisitor<O, L> {
/**
* The lock object, untyped, since, for example {@link StampedLock} does not implement a locking interface in
* Java 8.
*/
private final L lock; private final L lock;
/**
* The guarded object.
*/
private final O object; private final O object;
/**
* Supplies the read lock, usually from the lock object.
*/
private final Supplier<Lock> readLockSupplier; private final Supplier<Lock> readLockSupplier;
/**
* Supplies the write lock, usually from the lock object.
*/
private final Supplier<Lock> writeLockSupplier; private final Supplier<Lock> writeLockSupplier;
/**
* Constructs an instance.
*
* @param object The object to guard.
* @param lock The locking object.
* @param readLockSupplier Supplies the read lock, usually from the lock object.
* @param writeLockSupplier Supplies the write lock, usually from the lock object.
*/
protected LockVisitor(final O object, L lock, Supplier<Lock> readLockSupplier, Supplier<Lock> writeLockSupplier) { protected LockVisitor(final O object, L lock, Supplier<Lock> readLockSupplier, Supplier<Lock> writeLockSupplier) {
super(); super();
this.object = Objects.requireNonNull(object, "object"); this.object = Objects.requireNonNull(object, "object");
@ -210,7 +233,7 @@ public L getLock() {
} }
/** /**
* Gets the object. * Gets the guarded object.
* *
* @return the object. * @return the object.
*/ */