LifeCycle
@ManagedObject public class HouseKeeper extends AbstractLifeCycle
Modifier and Type | Class | Description |
---|---|---|
protected class |
HouseKeeper.Runner |
Runner
|
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Modifier and Type | Field | Description |
---|---|---|
protected boolean |
_ownScheduler |
|
protected HouseKeeper.Runner |
_runner |
|
protected Scheduler |
_scheduler |
|
protected SessionIdManager |
_sessionIdManager |
|
protected Scheduler.Task |
_task |
|
static long |
DEFAULT_PERIOD_MS |
FAILED, RUNNING, STARTED, STARTING, STOP_ON_FAILURE, STOPPED, STOPPING
Constructor | Description |
---|---|
HouseKeeper() |
Modifier and Type | Method | Description |
---|---|---|
protected void |
doStart() |
|
protected void |
doStop() |
|
protected void |
findScheduler() |
Get a scheduler.
|
long |
getIntervalSec() |
Get the period between scavenge cycles.
|
void |
scavenge() |
Periodically do session housekeeping
|
void |
setIntervalSec(long sec) |
Set the period between scavenge cycles
|
void |
setSessionIdManager(SessionIdManager sessionIdManager) |
SessionIdManager associated with this scavenger
|
protected void |
startScavenging() |
If scavenging is not scheduled, schedule it.
|
protected void |
stopScavenging() |
If scavenging is scheduled, stop it.
|
java.lang.String |
toString() |
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop
public static final long DEFAULT_PERIOD_MS
protected SessionIdManager _sessionIdManager
protected Scheduler _scheduler
protected Scheduler.Task _task
protected HouseKeeper.Runner _runner
protected boolean _ownScheduler
public void setSessionIdManager(SessionIdManager sessionIdManager)
sessionIdManager
- the session id managerprotected void doStart() throws java.lang.Exception
doStart
in class AbstractLifeCycle
java.lang.Exception
AbstractLifeCycle.doStart()
protected void findScheduler() throws java.lang.Exception
java.lang.Exception
- when the scheduler cannot be startedprotected void startScavenging() throws java.lang.Exception
java.lang.Exception
- if any error during scheduling the scavengingprotected void stopScavenging() throws java.lang.Exception
java.lang.Exception
- if any error during stopping the scavengingprotected void doStop() throws java.lang.Exception
doStop
in class AbstractLifeCycle
java.lang.Exception
AbstractLifeCycle.doStop()
public void setIntervalSec(long sec) throws java.lang.Exception
sec
- the interval (in seconds)java.lang.Exception
- if any error during restarting the scavenging@ManagedAttribute(value="secs between scavenge cycles", readonly=true) public long getIntervalSec()
public void scavenge()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
Copyright © 1995–2018 Webtide. All rights reserved.