public class Reaper extends Object implements Closeable
| Modifier and Type | Class and Description |
|---|---|
static class |
Reaper.Mode |
| Constructor and Description |
|---|
Reaper(org.apache.curator.framework.CuratorFramework client)
Uses the default reaping threshold of 5 minutes and creates an internal thread pool
|
Reaper(org.apache.curator.framework.CuratorFramework client,
int reapingThresholdMs)
Uses the given reaping threshold and creates an internal thread pool
|
Reaper(org.apache.curator.framework.CuratorFramework client,
ScheduledExecutorService executor,
int reapingThresholdMs) |
Reaper(org.apache.curator.framework.CuratorFramework client,
ScheduledExecutorService executor,
int reapingThresholdMs,
String leaderPath) |
| 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() |
static ScheduledExecutorService |
newExecutorService()
Allocate an executor service for the reaper
|
protected void |
reap(org.apache.curator.framework.recipes.locks.Reaper.PathHolder holder) |
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(org.apache.curator.framework.CuratorFramework client)
client - clientpublic Reaper(org.apache.curator.framework.CuratorFramework client,
int reapingThresholdMs)
client - clientreapingThresholdMs - threshold in milliseconds that determines that a path can be deletedpublic Reaper(org.apache.curator.framework.CuratorFramework client,
ScheduledExecutorService executor,
int reapingThresholdMs)
client - clientexecutor - thread poolreapingThresholdMs - threshold in milliseconds that determines that a path can be deletedpublic Reaper(org.apache.curator.framework.CuratorFramework client,
ScheduledExecutorService executor,
int reapingThresholdMs,
String leaderPath)
client - clientexecutor - thread poolreapingThresholdMs - threshold in milliseconds that determines that a path can be deletedleaderPath - if not null, uses a leader selection so that only 1 reaper is active in the clusterpublic 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 Closeableclose in interface AutoCloseableIOExceptionprotected Future<?> schedule(org.apache.curator.framework.recipes.locks.Reaper.PathHolder pathHolder, int reapingThresholdMs)
protected void reap(org.apache.curator.framework.recipes.locks.Reaper.PathHolder holder)
public static ScheduledExecutorService newExecutorService()
Copyright © 2011–2014 The Apache Software Foundation. All rights reserved.