User: jules_gosnell
Date: 02/02/12 13:48:42
Modified: jetty/src/main/org/jboss/jetty/session
DistributedHttpSessionManager.java
Log:
more work on interval snapshot strategy
Revision Changes Path
1.11 +38 -3
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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- DistributedHttpSessionManager.java 10 Feb 2002 17:57:41 -0000 1.10
+++ DistributedHttpSessionManager.java 12 Feb 2002 21:48:42 -0000 1.11
@@ -5,7 +5,7 @@
* See terms of license at gnu.org.
*/
-// $Id: DistributedHttpSessionManager.java,v 1.10 2002/02/10 17:57:41 olegnitz Exp $
+// $Id: DistributedHttpSessionManager.java,v 1.11 2002/02/12 21:48:42 jules_gosnell
Exp $
// TODO
@@ -15,6 +15,8 @@
// test....
// release !!!!
+// what am I going to do to stop threads on undeployment of app/context/jetty ?
+
//----------------------------------------
package org.jboss.jetty.session;
@@ -115,17 +117,21 @@
{
IntervalSnapshotStrategy iss=(IntervalSnapshotStrategy)object;
System.out.println("snapshotting HttpSessions for Context
("+iss._manager.getServletContext()+")");
- iss._timer.reregister(iss._manager, System.currentTimeMillis(),
iss._interval*1000);
+ iss._manager.snapshot(iss._notifyActivate, iss._notifyPassivate); //
should probably be done on another thread....
+ iss._timer.reregister(iss, System.currentTimeMillis(), iss._interval*1000);
}
public long
timeRemaining(Object object, long timeRegistered, long timeNow, long
maxInactiveInterval)
{
+ System.out.println("checking time left:
"+((timeRegistered+maxInactiveInterval)-timeNow));
return (timeRegistered+maxInactiveInterval)-timeNow;
}
}
static AbstractTimeOutManager _timer=new NaiveTimeOutManager(5*1000, new
TimeOutHelper());
+ static { _timer.start(); }
+
final int _interval;
final DistributedHttpSessionManager _manager;
@@ -176,7 +182,7 @@
//------------------------------------------------------------------------------
/**
*
- * @version $Id: DistributedHttpSessionManager.java,v 1.10 2002/02/10 17:57:41
olegnitz Exp $
+ * @version $Id: DistributedHttpSessionManager.java,v 1.11 2002/02/12 21:48:42
jules_gosnell Exp $
* @author [EMAIL PROTECTED]
*/
//----------------------------------------
@@ -259,11 +265,19 @@
}
if (snapshotFrequency.equalsIgnoreCase("never"))
+ {
tmp=new DummySnapshotStrategy();
+ }
else if (snapshotFrequency.equalsIgnoreCase("idle"))
+ {
tmp=new IdleSnapshotStrategy(notifyActivation, notifyPassivation);
+ _log.warn("IdleSnapshotStrategy - NYI");
+ }
else if (snapshotFrequency.equalsIgnoreCase("request"))
+ {
tmp=new RequestSnapshotStrategy(notifyActivation, notifyPassivation);
+ _log.warn("RequestSnapshotStrategy - NYI");
+ }
else
{
try
@@ -271,6 +285,7 @@
tmp=new IntervalSnapshotStrategy(this,
Integer.decode(snapshotFrequency).intValue(),
notifyActivation, notifyPassivation);
+ _log.info("using IntervalSnapshotStrategy: "+tmp);
}
catch (NumberFormatException e)
{
@@ -287,6 +302,26 @@
setDistributed(boolean isDistributed)
{
_isDistributed=isDistributed;
+ }
+
+ //----------------------------------------
+
+ public void
+ snapshot(boolean notifyActivate, boolean notifyPassivate)
+ {
+ if (_isStarted=false)
+ return;
+
+ List sessions;
+ synchronized (_sessions) {
+ sessions = new ArrayList(_sessions.values());
+ }
+
+ for (Iterator i = sessions.iterator(); i.hasNext(); )
+ {
+ DistributedHttpSession session=(DistributedHttpSession)i.next();
+ session.snapshot(notifyActivate, notifyPassivate);
+ }
}
//----------------------------------------
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development