public class Reaper extends Object implements Closeable
Modifier and Type | Class and Description |
---|---|
static class |
Reaper.Mode |
Constructor and Description |
---|
Reaper(CuratorFramework client)
Uses the default reaping threshold of 5 minutes and creates an internal thread pool
|
Reaper(CuratorFramework client,
int reapingThresholdMs)
Uses the given reaping threshold and creates an internal thread pool
|
Reaper(CuratorFramework client,
ScheduledExecutorService executor,
int reapingThresholdMs) |
Modifier and Type | Method and Description |
---|---|
void |
addPath(String path)
Add a path (using Mode.REAP_INDEFINITELY) to be checked by the reaper.
|
void |
addPath(String path,
Reaper.Mode mode)
Add a path to be checked by the reaper.
|
void |
close() |
boolean |
removePath(String path)
Stop reaping the given path
|
protected Future<?> |
schedule(org.apache.curator.framework.recipes.locks.Reaper.PathHolder pathHolder,
int reapingThresholdMs) |
void |
start()
The reaper must be started
|
public Reaper(CuratorFramework client)
client
- clientpublic Reaper(CuratorFramework client, int reapingThresholdMs)
client
- clientreapingThresholdMs
- threshold in milliseconds that determines that a path can be deletedpublic Reaper(CuratorFramework client, ScheduledExecutorService executor, int reapingThresholdMs)
client
- clientexecutor
- thread poolreapingThresholdMs
- threshold in milliseconds that determines that a path can be deletedpublic void addPath(String path)
path
- path to checkpublic void addPath(String path, Reaper.Mode mode)
path
- path to checkmode
- reaping modepublic boolean removePath(String path)
path
- path to removepublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
protected Future<?> schedule(org.apache.curator.framework.recipes.locks.Reaper.PathHolder pathHolder, int reapingThresholdMs)
Copyright © 2011–2014 The Apache Software Foundation. All rights reserved.