[JBoss-dev] CVS update: contrib/jetty/src/main/org/jboss/jetty/session AbstractDistributedStore.java ClusteredStore.java CoarseDistributedStore.java DistributedHttpSession.java DistributedHttpSessionManager.java
User: jules_gosnell Date: 02/01/15 16:36:51 Modified:jetty/src/main/org/jboss/jetty/session AbstractDistributedStore.java ClusteredStore.java CoarseDistributedStore.java DistributedHttpSession.java DistributedHttpSessionManager.java Log: prepare to hook ClusteredHTTPSession support to DistributedHttpSession. Revision ChangesPath 1.2 +4 -4 contrib/jetty/src/main/org/jboss/jetty/session/AbstractDistributedStore.java Index: AbstractDistributedStore.java === RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/session/AbstractDistributedStore.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AbstractDistributedStore.java 2002/01/14 22:25:18 1.1 +++ AbstractDistributedStore.java 2002/01/16 00:36:51 1.2 @@ -5,7 +5,7 @@ * See terms of license at gnu.org. */ -// $Id: AbstractDistributedStore.java,v 1.1 2002/01/14 22:25:18 jules_gosnell Exp $ +// $Id: AbstractDistributedStore.java,v 1.2 2002/01/16 00:36:51 jules_gosnell Exp $ // @@ -24,8 +24,8 @@ { public String nextId(); public AbstractHttpSessionData make(); - public AbstractHttpSessionData get(String id); - public void set(String id, AbstractHttpSessionData data); - //public void remove(String id); + public AbstractHttpSessionData get(String id, boolean delete); + public void put(String id, AbstractHttpSessionData data); + public void remove(String id); public boolean isValid(); } 1.2 +143 -10 contrib/jetty/src/main/org/jboss/jetty/session/ClusteredStore.java Index: ClusteredStore.java === RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/session/ClusteredStore.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ClusteredStore.java 2002/01/14 22:25:18 1.1 +++ ClusteredStore.java 2002/01/16 00:36:51 1.2 @@ -5,7 +5,7 @@ * See terms of license at gnu.org. */ -// $Id: ClusteredStore.java,v 1.1 2002/01/14 22:25:18 jules_gosnell Exp $ +// $Id: ClusteredStore.java,v 1.2 2002/01/16 00:36:51 jules_gosnell Exp $ // @@ -13,6 +13,98 @@ // +import org.jboss.logging.Logger; +import java.util.Map; + +// + +class + ClusteredHttpSessionData + implements AbstractHttpSessionData, java.io.Serializable +{ + String _id; + long_creationTime; + long_lastAccessedTime; + int _maxInactiveInterval; + Map _attributes; + boolean _attributesWerePassivated; + + // from javax.servlet.http.HttpSession + public long +getCreationTime() +{ + return _creationTime; +} + + public String +getId() +{ + return _id; +} + + public long +getLastAccessedTime() +{ + return _lastAccessedTime; +} + + public int +getMaxInactiveInterval() +{ + return _maxInactiveInterval; +} + + public void +setMaxInactiveInterval(int maxInactiveInterval) +{ + _maxInactiveInterval=_maxInactiveInterval; +} + + // extra accessors + public Map +getAttributes() +{ + return _attributes; +} + + public void +setAttributes(Map attributes) +{ + _attributes=attributes; +} + + public void +setId(String id) +{ + _id=id; +} + + public void +setCreationTime(long creationTime) +{ + _creationTime=creationTime; +} + + public void +setLastAccessedTime(long lastAccessedTime) +{ + _lastAccessedTime=lastAccessedTime; +} + + // extra attributes + public boolean +getAttributesWerePassivated() +{ + return _attributesWerePassivated; +} + + public void +setAttributesWerePassivated(boolean attributesWerePassivated) +{ + _attributesWerePassivated=attributesWerePassivated; +} +} + /** * An abstraction of a manager for the distributed store of HttpSessions * @@ -20,34 +112,51 @@ * @version 1.0 * @since 1.0 */ -abstract class +public class ClusteredStore + implements AbstractStore { - // ClusteredHTTPSessionServiceMBean _mbean; + final Logger _log=Logger.getLogger(getClass().getName()); + // final ClusteredHTTPSessionServiceMBean _mbean; public ClusteredStore() { + _log.info("CTOR"); // lookup JMX service } - public String +// public Str
[JBoss-dev] CVS update: contrib/jetty/src/main/org/jboss/jetty/session AbstractDistributedStore.java ClusteredStore.java CoarseDistributedStore.java DistributedHttpSession.java DistributedHttpSessionManager.java
User: jules_gosnell Date: 02/01/14 14:25:18 Modified:jetty/src/main/org/jboss/jetty/session CoarseDistributedStore.java DistributedHttpSession.java DistributedHttpSessionManager.java Added: jetty/src/main/org/jboss/jetty/session AbstractDistributedStore.java ClusteredStore.java Log: another step closer to working DistributedHttpSession. It now passes Watchdog with only 2 errors - the same as standalone Jetty. Update jars from Jetty cvs - I need a fix for the Session stuff to work Revision ChangesPath 1.3 +11 -20 contrib/jetty/src/main/org/jboss/jetty/session/CoarseDistributedStore.java Index: CoarseDistributedStore.java === RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/session/CoarseDistributedStore.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- CoarseDistributedStore.java 2002/01/13 21:30:13 1.2 +++ CoarseDistributedStore.java 2002/01/14 22:25:18 1.3 @@ -5,7 +5,7 @@ * See terms of license at gnu.org. */ -// $Id: CoarseDistributedStore.java,v 1.2 2002/01/13 21:30:13 jules_gosnell Exp $ +// $Id: CoarseDistributedStore.java,v 1.3 2002/01/14 22:25:18 jules_gosnell Exp $ // @@ -28,23 +28,6 @@ // /** - * An abstraction of a manager for the distributed store of HttpSessions - * - * @author mailto:jules_gosnell@@yahoo.com";>Jules Gosnell - * @version 1.0 - * @since 1.0 - */ -interface AbstractStore -{ - public String nextId(); - public AbstractHttpSessionData make(); - public AbstractHttpSessionData get(String id); - public void set(String id, AbstractHttpSessionData data); -} - -// - -/** * An implementation of a manager of a CMP based distributed store of HttpSessions * * @author mailto:jules_gosnell@@yahoo.com";>Jules Gosnell @@ -52,7 +35,8 @@ * @since 1.0 * @see AbstractStore */ -class EJBDistributedStore +public class + CoarseDistributedStore implements AbstractStore { Logger_log = Logger.getLogger(getClass().getName()); @@ -60,7 +44,8 @@ CoarseHttpSessionHome _home; String_name="ejb/jetty/CoarseHttpSession"; // TODO - parameterise - EJBDistributedStore() + public +CoarseDistributedStore() { try { @@ -150,4 +135,10 @@ } return ""+System.currentTimeMillis()+"-"+id; } + + public boolean +isValid() +{ + return (_home!=null); +} } 1.3 +3 -8 contrib/jetty/src/main/org/jboss/jetty/session/DistributedHttpSession.java Index: DistributedHttpSession.java === RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/session/DistributedHttpSession.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DistributedHttpSession.java 2002/01/13 21:30:14 1.2 +++ DistributedHttpSession.java 2002/01/14 22:25:18 1.3 @@ -236,6 +236,8 @@ invalidate() throws IllegalStateException { +if (!isValid()) throw new IllegalStateException(); + _isValid=false; _manager.destroyHttpSession(this); } @@ -309,14 +311,9 @@ // perhaps this test should have been 'equals()' - but I // figure that would be too expensive... - TODO - Object tmp=value; // assume an attribute was added - // notify the old value if necessary if (oldValue!=null) - { notifyValueUnbound(name, oldValue); - tmp=oldValue; // actually - an attribute was replaced - } // notify the new value if necessary notifyValueBound(name, value); @@ -340,7 +337,7 @@ { if (!isValid()) throw new IllegalStateException(); -Object oldValue=null; +Object oldValue; synchronized (_attributes) { oldValue=_attributes.remove(name); } @@ -516,8 +513,6 @@ data.setMaxInactiveInterval(getMaxInactiveInterval()); data.setAttributesWerePassivated(notifyAttributes); _manager.getStore().set(getId(), data); - - _log.info("Session passivated: "+getId()); } } 1.3 +37 -28 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.2 retrie