Commit f4062c4b authored by Ard Schrijvers's avatar Ard Schrijvers

CMS-10897 Describe the LockManagerUtils in the javadoc as well

Explain the difference between LockManager and ReentrantLock and
explain how the cluster wide ReentrantLock behavior can be achieved
with the LockManagerUtils
parent 7de60944
......@@ -16,6 +16,8 @@
package org.onehippo.cms7.services.lock;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
import org.onehippo.cms7.services.SingletonService;
......@@ -61,6 +63,14 @@ import org.onehippo.cms7.services.SingletonService;
* </pre>
* </code>
* </p>
* <p>
* Note that when a {@code key} is already locked, the invocation of {@link #lock(String) #lock(key)} directly results
* in an {@link AlreadyLockedException} : This is thus <strong>different</strong> than
* {@link java.util.concurrent.locks.ReentrantLock} behavior. If you need similar behavior to {@link ReentrantLock#lock()}
* but then <strong>cluster wide</strong>, you can use {@link LockManagerUtils#waitForLock(LockManager, String, long)}
* and if you need the cluster wide equivalent of {@link java.util.concurrent.locks.ReentrantLock#tryLock(long, TimeUnit)}
* you can use {@link LockManagerUtils#waitForLock(LockManager, String, long, long)}.
* </p>
*
*/
@SingletonService
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment