Class CuratorUtils

java.lang.Object
org.apache.druid.curator.CuratorUtils

public class CuratorUtils extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    createIfNotExists(org.apache.curator.framework.CuratorFramework curatorFramework, String path, org.apache.zookeeper.CreateMode mode, byte[] rawBytes, int maxZnodeBytes)
    Create znode if it does not already exist.
    static void
    createOrSet(org.apache.curator.framework.CuratorFramework curatorFramework, String path, org.apache.zookeeper.CreateMode mode, byte[] rawBytes, int maxZnodeBytes)
    Create znode if it does not already exist.
    static boolean
    isChildAdded(org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent event)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_MAX_ZNODE_BYTES

      public static final int DEFAULT_MAX_ZNODE_BYTES
      See Also:
  • Constructor Details

    • CuratorUtils

      public CuratorUtils()
  • Method Details

    • createIfNotExists

      public static void createIfNotExists(org.apache.curator.framework.CuratorFramework curatorFramework, String path, org.apache.zookeeper.CreateMode mode, byte[] rawBytes, int maxZnodeBytes) throws Exception
      Create znode if it does not already exist. If it does already exist, this does nothing. In particular, the existing znode may have a different payload or create mode.
      Parameters:
      curatorFramework - curator
      path - path
      mode - create mode
      rawBytes - payload
      maxZnodeBytes - maximum payload size
      Throws:
      IllegalArgumentException - if rawBytes.length > maxZnodeBytes
      Exception - if Curator throws an Exception
    • createOrSet

      public static void createOrSet(org.apache.curator.framework.CuratorFramework curatorFramework, String path, org.apache.zookeeper.CreateMode mode, byte[] rawBytes, int maxZnodeBytes) throws Exception
      Create znode if it does not already exist. If it does already exist, update the payload (but not the create mode). If someone deletes the znode while we're trying to set it, just let it stay deleted.
      Parameters:
      curatorFramework - curator
      path - path
      mode - create mode
      rawBytes - payload
      maxZnodeBytes - maximum payload size
      Throws:
      IllegalArgumentException - if rawBytes.length > maxZnodeBytes
      Exception - if Curator throws an Exception
    • isChildAdded

      public static boolean isChildAdded(org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent event)