You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ti...@apache.org on 2022/06/26 12:45:56 UTC

[curator] branch master updated (f4abf511 -> 0a76a61f)

This is an automated email from the ASF dual-hosted git repository.

tison pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


    from f4abf511 CURATOR-643: Add option to disable parent creation for PersistentTtlNode (#422)
     new 16db9230 CURATOR-643: Rescue public ctor of PersistentTtlNode
     new 0a76a61f CURATOR-643: Replace literal boolean with named constant

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../framework/recipes/nodes/PersistentTtlNode.java     | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)


[curator] 02/02: CURATOR-643: Replace literal boolean with named constant

Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 0a76a61f112e960c330a3365457776621bb430cc
Author: tison <wa...@gmail.com>
AuthorDate: Sun Jun 26 20:45:47 2022 +0800

    CURATOR-643: Replace literal boolean with named constant
    
    Signed-off-by: tison <wa...@gmail.com>
---
 .../apache/curator/framework/recipes/nodes/PersistentTtlNode.java    | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentTtlNode.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentTtlNode.java
index c8d2562e..6a0f15b6 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentTtlNode.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentTtlNode.java
@@ -58,6 +58,7 @@ public class PersistentTtlNode implements Closeable
 {
     public static final String DEFAULT_CHILD_NODE_NAME = "touch";
     public static final int DEFAULT_TOUCH_SCHEDULE_FACTOR = 2;
+    public static final boolean DEFAULT_USE_PARENT_CREATION = true;
 
     private final Logger log = LoggerFactory.getLogger(getClass());
     private final PersistentNode node;
@@ -76,7 +77,7 @@ public class PersistentTtlNode implements Closeable
      */
     public PersistentTtlNode(CuratorFramework client, String path, long ttlMs, byte[] initData)
     {
-        this(client, Executors.newSingleThreadScheduledExecutor(ThreadUtils.newThreadFactory("PersistentTtlNode")), path, ttlMs, initData, DEFAULT_CHILD_NODE_NAME, DEFAULT_TOUCH_SCHEDULE_FACTOR, true);
+        this(client, Executors.newSingleThreadScheduledExecutor(ThreadUtils.newThreadFactory("PersistentTtlNode")), path, ttlMs, initData, DEFAULT_CHILD_NODE_NAME, DEFAULT_TOUCH_SCHEDULE_FACTOR, DEFAULT_USE_PARENT_CREATION);
     }
 
     /**
@@ -103,7 +104,7 @@ public class PersistentTtlNode implements Closeable
      */
     public PersistentTtlNode(CuratorFramework client, ScheduledExecutorService executorService, String path, long ttlMs, byte[] initData, String childNodeName, int touchScheduleFactor)
     {
-        this(client, executorService, path, ttlMs, initData, childNodeName, touchScheduleFactor, true);
+        this(client, executorService, path, ttlMs, initData, childNodeName, touchScheduleFactor, DEFAULT_USE_PARENT_CREATION);
     }
 
     /**


[curator] 01/02: CURATOR-643: Rescue public ctor of PersistentTtlNode

Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 16db9230a95339265f34dce95716aee7a50f73f2
Author: tison <wa...@gmail.com>
AuthorDate: Sun Jun 26 20:43:20 2022 +0800

    CURATOR-643: Rescue public ctor of PersistentTtlNode
    
    Signed-off-by: tison <wa...@gmail.com>
---
 .../framework/recipes/nodes/PersistentTtlNode.java        | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentTtlNode.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentTtlNode.java
index 9f019d6e..c8d2562e 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentTtlNode.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentTtlNode.java
@@ -91,6 +91,21 @@ public class PersistentTtlNode implements Closeable
         this(client, Executors.newSingleThreadScheduledExecutor(ThreadUtils.newThreadFactory("PersistentTtlNode")), path, ttlMs, initData, DEFAULT_CHILD_NODE_NAME, DEFAULT_TOUCH_SCHEDULE_FACTOR, useParentCreation);
     }
 
+    /**
+     * @param client the client
+     * @param executorService  ExecutorService to use for background thread. This service should be single threaded, otherwise you may see inconsistent results.
+     * @param path path for the parent ZNode
+     * @param ttlMs max ttl for the node in milliseconds
+     * @param initData data for the node
+     * @param childNodeName name to use for the child node of the node created at <code>path</code>
+     * @param touchScheduleFactor how ofter to set/create the child node as a factor of the ttlMs. i.e.
+     *                            the child is touched every <code>(ttlMs / touchScheduleFactor)</code>
+     */
+    public PersistentTtlNode(CuratorFramework client, ScheduledExecutorService executorService, String path, long ttlMs, byte[] initData, String childNodeName, int touchScheduleFactor)
+    {
+        this(client, executorService, path, ttlMs, initData, childNodeName, touchScheduleFactor, true);
+    }
+
     /**
      * @param client the client
      * @param executorService  ExecutorService to use for background thread. This service should be single threaded, otherwise you may see inconsistent results.