Class ChildReaper

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    @Deprecated
    public class ChildReaper
    extends java.lang.Object
    implements java.io.Closeable
    Deprecated.
    Since 2.9.0 - Reaper/ChildReaper are no longer needed. Use CreateMode.CONTAINER. Also, all Curator recipes create container parents.
    Utility to reap empty child nodes of a parent node. Periodically calls getChildren on the node and adds empty nodes to an internally managed Reaper
    • Constructor Summary

      Constructors 
      Constructor Description
      ChildReaper​(org.apache.curator.framework.CuratorFramework client, java.lang.String path, Reaper.Mode mode)
      Deprecated.
       
      ChildReaper​(org.apache.curator.framework.CuratorFramework client, java.lang.String path, Reaper.Mode mode, int reapingThresholdMs)
      Deprecated.
       
      ChildReaper​(org.apache.curator.framework.CuratorFramework client, java.lang.String path, Reaper.Mode mode, java.util.concurrent.ScheduledExecutorService executor, int reapingThresholdMs)
      Deprecated.
       
      ChildReaper​(org.apache.curator.framework.CuratorFramework client, java.lang.String path, Reaper.Mode mode, java.util.concurrent.ScheduledExecutorService executor, int reapingThresholdMs, java.lang.String leaderPath)
      Deprecated.
       
      ChildReaper​(org.apache.curator.framework.CuratorFramework client, java.lang.String path, Reaper.Mode mode, java.util.concurrent.ScheduledExecutorService executor, int reapingThresholdMs, java.lang.String leaderPath, java.util.Set<java.lang.String> lockSchema)
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      ChildReaper addPath​(java.lang.String path)
      Deprecated.
      Add a path to reap children from
      void close()
      Deprecated.
       
      static java.util.concurrent.ScheduledExecutorService newExecutorService()
      Deprecated.
       
      boolean removePath​(java.lang.String path)
      Deprecated.
      Remove a path from reaping
      void setMaxChildren​(int maxChildren)
      Deprecated.
      If a node has so many children that CuratorFramework.getChildren() will fail (due to jute.maxbuffer) it can cause connection instability.
      void start()
      Deprecated.
      The reaper must be started
      protected void warnMaxChildren​(java.lang.String path, org.apache.zookeeper.data.Stat stat)
      Deprecated.
       
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ChildReaper

        public ChildReaper​(org.apache.curator.framework.CuratorFramework client,
                           java.lang.String path,
                           Reaper.Mode mode)
        Deprecated.
        Parameters:
        client - the client
        path - path to reap children from
        mode - reaping mode
      • ChildReaper

        public ChildReaper​(org.apache.curator.framework.CuratorFramework client,
                           java.lang.String path,
                           Reaper.Mode mode,
                           int reapingThresholdMs)
        Deprecated.
        Parameters:
        client - the client
        path - path to reap children from
        reapingThresholdMs - threshold in milliseconds that determines that a path can be deleted
        mode - reaping mode
      • ChildReaper

        public ChildReaper​(org.apache.curator.framework.CuratorFramework client,
                           java.lang.String path,
                           Reaper.Mode mode,
                           java.util.concurrent.ScheduledExecutorService executor,
                           int reapingThresholdMs)
        Deprecated.
        Parameters:
        client - the client
        path - path to reap children from
        executor - executor to use for background tasks
        reapingThresholdMs - threshold in milliseconds that determines that a path can be deleted
        mode - reaping mode
      • ChildReaper

        public ChildReaper​(org.apache.curator.framework.CuratorFramework client,
                           java.lang.String path,
                           Reaper.Mode mode,
                           java.util.concurrent.ScheduledExecutorService executor,
                           int reapingThresholdMs,
                           java.lang.String leaderPath)
        Deprecated.
        Parameters:
        client - the client
        path - path to reap children from
        executor - executor to use for background tasks
        reapingThresholdMs - threshold in milliseconds that determines that a path can be deleted
        mode - reaping mode
        leaderPath - if not null, uses a leader selection so that only 1 reaper is active in the cluster
      • ChildReaper

        public ChildReaper​(org.apache.curator.framework.CuratorFramework client,
                           java.lang.String path,
                           Reaper.Mode mode,
                           java.util.concurrent.ScheduledExecutorService executor,
                           int reapingThresholdMs,
                           java.lang.String leaderPath,
                           java.util.Set<java.lang.String> lockSchema)
        Deprecated.
        Parameters:
        client - the client
        path - path to reap children from
        executor - executor to use for background tasks
        reapingThresholdMs - threshold in milliseconds that determines that a path can be deleted
        mode - reaping mode
        leaderPath - if not null, uses a leader selection so that only 1 reaper is active in the cluster
        lockSchema - a set of the possible subnodes of the children of path that must be reaped in addition to the child nodes
    • Method Detail

      • start

        public void start()
                   throws java.lang.Exception
        Deprecated.
        The reaper must be started
        Throws:
        java.lang.Exception - errors
      • close

        public void close()
                   throws java.io.IOException
        Deprecated.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • addPath

        public ChildReaper addPath​(java.lang.String path)
        Deprecated.
        Add a path to reap children from
        Parameters:
        path - the path
        Returns:
        this for chaining
      • removePath

        public boolean removePath​(java.lang.String path)
        Deprecated.
        Remove a path from reaping
        Parameters:
        path - the path
        Returns:
        true if the path existed and was removed
      • setMaxChildren

        public void setMaxChildren​(int maxChildren)
        Deprecated.
        If a node has so many children that CuratorFramework.getChildren() will fail (due to jute.maxbuffer) it can cause connection instability. Set the max number of children here to prevent the path from being queried in these cases. The number should usually be: average-node-name-length/1000000
        Parameters:
        maxChildren - max children
      • newExecutorService

        public static java.util.concurrent.ScheduledExecutorService newExecutorService()
        Deprecated.
      • warnMaxChildren

        protected void warnMaxChildren​(java.lang.String path,
                                       org.apache.zookeeper.data.Stat stat)
        Deprecated.