List of usage examples for org.apache.zookeeper CreateMode CONTAINER
CreateMode CONTAINER
To view the source code for org.apache.zookeeper CreateMode CONTAINER.
Click Source Link
From source file:org.apache.curator.framework.recipes.nodes.PersistentTtlNode.java
License:Apache License
/** * @param client the client/*from w w w . jav a 2 s .co m*/ * @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 = Objects.requireNonNull(client, "client cannot be null"); this.ttlMs = ttlMs; this.touchScheduleFactor = touchScheduleFactor; node = new PersistentNode(client, CreateMode.CONTAINER, false, path, initData) { @Override protected void deleteNode() { // NOP } }; this.executorService = Objects.requireNonNull(executorService, "executorService cannot be null"); childPath = ZKPaths.makePath(Objects.requireNonNull(path, "path cannot be null"), childNodeName); }