org.apache.curator.framework.recipes.locks
Class ChildReaper

java.lang.Object
  extended by org.apache.curator.framework.recipes.locks.ChildReaper
All Implemented Interfaces:
Closeable

public class ChildReaper
extends Object
implements Closeable

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
ChildReaper(org.apache.curator.framework.CuratorFramework client, String path, Reaper.Mode mode)
           
ChildReaper(org.apache.curator.framework.CuratorFramework client, String path, Reaper.Mode mode, int reapingThresholdMs)
           
ChildReaper(org.apache.curator.framework.CuratorFramework client, String path, Reaper.Mode mode, ScheduledExecutorService executor, int reapingThresholdMs)
           
ChildReaper(org.apache.curator.framework.CuratorFramework client, String path, Reaper.Mode mode, ScheduledExecutorService executor, int reapingThresholdMs, String leaderPath)
           
 
Method Summary
 void close()
           
 void start()
          The reaper must be started
 
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,
                   String path,
                   Reaper.Mode mode)
Parameters:
client - the client
path - path to reap children from
mode - reaping mode

ChildReaper

public ChildReaper(org.apache.curator.framework.CuratorFramework client,
                   String path,
                   Reaper.Mode mode,
                   int reapingThresholdMs)
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,
                   String path,
                   Reaper.Mode mode,
                   ScheduledExecutorService executor,
                   int reapingThresholdMs)
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,
                   String path,
                   Reaper.Mode mode,
                   ScheduledExecutorService executor,
                   int reapingThresholdMs,
                   String leaderPath)
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
Method Detail

start

public void start()
           throws Exception
The reaper must be started

Throws:
Exception - errors

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Throws:
IOException


Copyright © 2011–2014 The Apache Software Foundation. All rights reserved.