public class ExpiryMonitor extends Object implements Runnable, Disposable
ExpiryMonitor
can monitor objects beased on an expiry time and can
invoke a callback method once the object time has expired. If the object does
expire it is removed from this monitor.Modifier and Type | Field and Description |
---|---|
protected static org.apache.commons.logging.Log |
logger
logger used by this class
|
protected edu.emory.mathcs.backport.java.util.concurrent.ScheduledThreadPoolExecutor |
scheduler |
PHASE_NAME
Constructor and Description |
---|
ExpiryMonitor(String name) |
ExpiryMonitor(String name,
int monitorFrequency) |
ExpiryMonitor(String name,
int monitorFrequency,
edu.emory.mathcs.backport.java.util.concurrent.ScheduledThreadPoolExecutor scheduler) |
Modifier and Type | Method and Description |
---|---|
void |
addExpirable(long value,
edu.emory.mathcs.backport.java.util.concurrent.TimeUnit timeUnit,
Expirable expirable)
Adds an expirable object to monitor.
|
void |
dispose()
A lifecycle method where implementor should free up any resources.
|
protected void |
init() |
boolean |
isRegistered(Expirable expirable) |
void |
removeExpirable(Expirable expirable) |
void |
resetExpirable(Expirable expirable) |
void |
run()
The action to be performed by this timer task.
|
protected static final org.apache.commons.logging.Log logger
protected edu.emory.mathcs.backport.java.util.concurrent.ScheduledThreadPoolExecutor scheduler
public ExpiryMonitor(String name)
public ExpiryMonitor(String name, int monitorFrequency)
public ExpiryMonitor(String name, int monitorFrequency, edu.emory.mathcs.backport.java.util.concurrent.ScheduledThreadPoolExecutor scheduler)
protected void init()
public void addExpirable(long value, edu.emory.mathcs.backport.java.util.concurrent.TimeUnit timeUnit, Expirable expirable)
value
- the expiry valuetimeUnit
- The time unit of the Expiry valueexpirable
- the objec that will expirepublic boolean isRegistered(Expirable expirable)
public void removeExpirable(Expirable expirable)
public void resetExpirable(Expirable expirable)
public void run()
public void dispose()
Disposable
dispose
in interface Disposable
Copyright © 2003-2012 MuleSource, Inc.. All Rights Reserved.