curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject curator git commit: doc the new Locker
Date Tue, 08 Sep 2015 23:14:26 GMT
Repository: curator
Updated Branches:
  refs/heads/CURATOR-3.0 cee1c0eab -> 39fd9255a


doc the new Locker


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/39fd9255
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/39fd9255
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/39fd9255

Branch: refs/heads/CURATOR-3.0
Commit: 39fd9255af429b48809577a631bd0da7f2ca341e
Parents: cee1c0e
Author: randgalt <randgalt@apache.org>
Authored: Tue Sep 8 18:14:18 2015 -0500
Committer: randgalt <randgalt@apache.org>
Committed: Tue Sep 8 18:14:18 2015 -0500

----------------------------------------------------------------------
 src/site/confluence/utilities.confluence | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/39fd9255/src/site/confluence/utilities.confluence
----------------------------------------------------------------------
diff --git a/src/site/confluence/utilities.confluence b/src/site/confluence/utilities.confluence
index f0d927d..efacb3c 100644
--- a/src/site/confluence/utilities.confluence
+++ b/src/site/confluence/utilities.confluence
@@ -14,6 +14,18 @@ Various static methods to help with using ZooKeeper ZNode paths:
 * getSortedChildren: Return the children of the given path sorted by sequence number
 * makePath: Given a parent path and a child node, create a combined full path
 
+h2. Locker
+
+Curator's Locker uses Java 7's try\-with\-resources feature to making using Curator locks
safer:
+
+{code}
+InterProcessMutex mutex = new InterProcessMutex(...) // or any InterProcessLock
+try ( Locker locker = new Locker(mutex, maxTimeout, unit) )
+{
+   // do work
+}
+{code}
+
 h2. BlockingQueueConsumer
 
 See: *[[DistributedQueue|curator-recipes/distributed-queue.html]]* and *[[DistributedPriorityQueue|curator-recipes/distributed-priority-queue.html]]*


Mime
View raw message