- java.lang.Object
-
- org.eclipse.jetty.util.component.AbstractLifeCycle
-
- org.eclipse.jetty.server.session.HouseKeeper
-
- All Implemented Interfaces:
org.eclipse.jetty.util.component.LifeCycle
@ManagedObject public class HouseKeeper extends org.eclipse.jetty.util.component.AbstractLifeCycle
HouseKeeper There is 1 session HouseKeeper per SessionIdManager instance.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
HouseKeeper.Runner
Runner
-
Field Summary
Fields Modifier and Type Field Description protected boolean
_ownScheduler
protected HouseKeeper.Runner
_runner
protected org.eclipse.jetty.util.thread.Scheduler
_scheduler
protected SessionIdManager
_sessionIdManager
protected org.eclipse.jetty.util.thread.Scheduler.Task
_task
static long
DEFAULT_PERIOD_MS
-
Constructor Summary
Constructors Constructor Description HouseKeeper()
-
Method Summary
All Methods Instance Methods Concrete Methods 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 housekeepingvoid
setIntervalSec(long sec)
Set the period between scavenge cyclesvoid
setSessionIdManager(SessionIdManager sessionIdManager)
SessionIdManager associated with this scavengerprotected void
startScavenging()
If scavenging is not scheduled, schedule it.protected void
stopScavenging()
If scavenging is scheduled, stop it.java.lang.String
toString()
-
-
-
Field Detail
-
DEFAULT_PERIOD_MS
public static final long DEFAULT_PERIOD_MS
- See Also:
- Constant Field Values
-
_sessionIdManager
protected SessionIdManager _sessionIdManager
-
_scheduler
protected org.eclipse.jetty.util.thread.Scheduler _scheduler
-
_task
protected org.eclipse.jetty.util.thread.Scheduler.Task _task
-
_runner
protected HouseKeeper.Runner _runner
-
_ownScheduler
protected boolean _ownScheduler
-
-
Method Detail
-
setSessionIdManager
public void setSessionIdManager(SessionIdManager sessionIdManager)
SessionIdManager associated with this scavenger- Parameters:
sessionIdManager
- the session id manager
-
doStart
protected void doStart() throws java.lang.Exception
- Overrides:
doStart
in classorg.eclipse.jetty.util.component.AbstractLifeCycle
- Throws:
java.lang.Exception
-
findScheduler
protected void findScheduler() throws java.lang.Exception
Get a scheduler. First try a common scheduler, failing that create our own.- Throws:
java.lang.Exception
- when the scheduler cannot be started
-
startScavenging
protected void startScavenging() throws java.lang.Exception
If scavenging is not scheduled, schedule it.- Throws:
java.lang.Exception
- if any error during scheduling the scavenging
-
stopScavenging
protected void stopScavenging() throws java.lang.Exception
If scavenging is scheduled, stop it.- Throws:
java.lang.Exception
- if any error during stopping the scavenging
-
doStop
protected void doStop() throws java.lang.Exception
- Overrides:
doStop
in classorg.eclipse.jetty.util.component.AbstractLifeCycle
- Throws:
java.lang.Exception
-
setIntervalSec
public void setIntervalSec(long sec) throws java.lang.Exception
Set the period between scavenge cycles- Parameters:
sec
- the interval (in seconds)- Throws:
java.lang.Exception
- if any error during restarting the scavenging
-
getIntervalSec
@ManagedAttribute(value="secs between scavenge cycles", readonly=true) public long getIntervalSec()
Get the period between scavenge cycles.- Returns:
- the interval (in seconds)
-
scavenge
public void scavenge()
Periodically do session housekeeping
-
toString
public java.lang.String toString()
- Overrides:
toString
in classorg.eclipse.jetty.util.component.AbstractLifeCycle
-
-