User: jules_gosnell
Date: 02/02/12 17:03:06
Modified: jetty/src/main/org/jboss/jetty/session
DistributedHttpSessionManager.java
Log:
ensure that background threads get tidied up if Jetty is bounced
Revision Changes Path
1.12 +49 -31
contrib/jetty/src/main/org/jboss/jetty/session/DistributedHttpSessionManager.java
Index: DistributedHttpSessionManager.java
===================================================================
RCS file:
/cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/session/DistributedHttpSessionManager.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- DistributedHttpSessionManager.java 12 Feb 2002 21:48:42 -0000 1.11
+++ DistributedHttpSessionManager.java 13 Feb 2002 01:03:06 -0000 1.12
@@ -5,7 +5,7 @@
* See terms of license at gnu.org.
*/
-// $Id: DistributedHttpSessionManager.java,v 1.11 2002/02/12 21:48:42 jules_gosnell
Exp $
+// $Id: DistributedHttpSessionManager.java,v 1.12 2002/02/13 01:03:06 jules_gosnell
Exp $
// TODO
@@ -56,40 +56,49 @@
final boolean _notifyPassivate;
SnapshotStrategy()
- {
- _notifyActivate=false;
- _notifyPassivate=false;
- }
+ {
+ _notifyActivate=false;
+ _notifyPassivate=false;
+ }
SnapshotStrategy(boolean notifyActivate, boolean notifyPassivate)
- {
- _notifyActivate=notifyActivate;
- _notifyPassivate=notifyPassivate;
- }
+ {
+ _notifyActivate=notifyActivate;
+ _notifyPassivate=notifyPassivate;
+ }
public void
snapshot(DistributedHttpSession session)
- {
- session.snapshot(_notifyActivate, _notifyPassivate);
- }
+ {
+ session.snapshot(_notifyActivate, _notifyPassivate);
+ }
public boolean
getNotifyActivate()
- {
- return _notifyActivate;
- }
+ {
+ return _notifyActivate;
+ }
public boolean
getNotifyPassivate()
- {
- return _notifyPassivate;
- }
+ {
+ return _notifyPassivate;
+ }
+
+ public void
+ start()
+ {}
+
+ public void
+ stop()
+ {}
}
class DummySnapshotStrategy
extends SnapshotStrategy
{
- public void snapshot(DistributedHttpSession session)
+ public void
+ snapshot(DistributedHttpSession session)
{}
}
@@ -130,8 +139,6 @@
}
static AbstractTimeOutManager _timer=new NaiveTimeOutManager(5*1000, new
TimeOutHelper());
- static { _timer.start(); }
-
final int _interval;
final DistributedHttpSessionManager _manager;
@@ -144,6 +151,18 @@
_timer.register(this, System.currentTimeMillis(), _interval*1000);
}
+
+ public void
+ start()
+ {
+ _timer.start();
+ }
+
+ public void
+ stop()
+ {
+ _timer.stop();
+ }
}
class IdleSnapshotStrategy
@@ -182,7 +201,7 @@
//------------------------------------------------------------------------------
/**
*
- * @version $Id: DistributedHttpSessionManager.java,v 1.11 2002/02/12 21:48:42
jules_gosnell Exp $
+ * @version $Id: DistributedHttpSessionManager.java,v 1.12 2002/02/13 01:03:06
jules_gosnell Exp $
* @author [EMAIL PROTECTED]
*/
//----------------------------------------
@@ -191,8 +210,6 @@
implements org.mortbay.jetty.servlet.SessionManager
{
static AbstractTimeOutManager _scavenger =new
NaiveTimeOutManager(5*1000, new MyTimeOutHelper());
- static { _scavenger.start(); }
-
final AbstractStore _store;
final SnapshotStrategy _snapshotStrategy;
final Logger _log;
@@ -282,14 +299,13 @@
{
try
{
- tmp=new IntervalSnapshotStrategy(this,
- Integer.decode(snapshotFrequency).intValue(),
- notifyActivation, notifyPassivation);
- _log.info("using IntervalSnapshotStrategy: "+tmp);
+ int numSeconds=Integer.decode(snapshotFrequency).intValue();
+ tmp=new IntervalSnapshotStrategy(this, numSeconds, notifyActivation,
notifyPassivation);
+ _log.info("using IntervalSnapshotStrategy: every "+numSeconds+" seconds");
}
catch (NumberFormatException e)
{
- _log.warn("bad HttpSessionSnapshotFrequency: "+snapshotFrequency+" - should be
never/idle/request/<#minutes>");
+ _log.warn("bad HttpSessionSnapshotFrequency: "+snapshotFrequency+" - should be
never/idle/request/<num-seconds>");
tmp=new DummySnapshotStrategy();
}
}
@@ -423,7 +439,8 @@
throws Exception
{
_isStarted=true;
- // _scavenger.start();
+ _scavenger.start();
+ _snapshotStrategy.start();
// sessions are activated lazily...
}
@@ -431,7 +448,8 @@
public void
stop() // TODO
{
- // _scavenger.stop();
+ _snapshotStrategy.stop();
+ _scavenger.stop();
_isStarted=false; // TODO
// tidy up all sessions...
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development