You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ki...@apache.org on 2001/04/08 10:02:04 UTC

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session ManagerBase.java

kief        01/04/08 01:02:04

  Modified:    catalina/src/share/org/apache/catalina/session
                        ManagerBase.java
  Log:
  Refactoring to eliminate dependencies by StandardManager, ManagerBase,
  and StandardSession on one another: each should only depend on methods
  found in the interface definitions for Manager and Session.
  
  Revision  Changes    Path
  1.6       +35 -35    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/ManagerBase.java
  
  Index: ManagerBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/ManagerBase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ManagerBase.java	2001/03/14 02:17:22	1.5
  +++ ManagerBase.java	2001/04/08 08:02:04	1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/ManagerBase.java,v 1.5 2001/03/14 02:17:22 craigmcc Exp $
  - * $Revision: 1.5 $
  - * $Date: 2001/03/14 02:17:22 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/ManagerBase.java,v 1.6 2001/04/08 08:02:04 kief Exp $
  + * $Revision: 1.6 $
  + * $Date: 2001/04/08 08:02:04 $
    *
    * ====================================================================
    *
  @@ -86,7 +86,7 @@
    * be subclassed to create more sophisticated Manager implementations.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.5 $ $Date: 2001/03/14 02:17:22 $
  + * @version $Revision: 1.6 $ $Date: 2001/04/08 08:02:04 $
    */
   
   public abstract class ManagerBase implements Manager {
  @@ -474,6 +474,20 @@
   
   
       /**
  +     * Add this Session to the set of active Sessions for this Manager.
  +     *
  +     * @param session Session to be added
  +     */
  +    public void add(Session session) {
  +
  +	synchronized (sessions) {
  +	    sessions.put(session.getId(), session);
  +	}
  +
  +    }
  +
  +
  +    /**
        * Add a property change listener to this component.
        *
        * @param listener The listener to add
  @@ -498,11 +512,11 @@
       public Session createSession() {
   
   	// Recycle or create a Session instance
  -	StandardSession session = null;
  +	Session session = null;
   	synchronized (recycled) {
   	    int size = recycled.size();
   	    if (size > 0) {
  -		session = (StandardSession) recycled.get(size - 1);
  +		session = (Session) recycled.get(size - 1);
   		recycled.remove(size - 1);
   	    }
   	}
  @@ -570,6 +584,20 @@
   
   
       /**
  +     * Remove this Session from the active Sessions for this Manager.
  +     *
  +     * @param session Session to be removed
  +     */
  +    public void remove(Session session) {
  +
  +	synchronized (sessions) {
  +	    sessions.remove(session.getId());
  +	}
  +
  +    }
  +
  +
  +    /**
        * Remove a property change listener from this component.
        *
        * @param listener The listener to remove
  @@ -618,20 +646,6 @@
   
   
       /**
  -     * Add this Session to the set of active Sessions for this Manager.
  -     *
  -     * @param session Session to be added
  -     */
  -    void add(StandardSession session) {
  -
  -	synchronized (sessions) {
  -	    sessions.put(session.getId(), session);
  -	}
  -
  -    }
  -
  -
  -    /**
        * Log a message on the Logger associated with our Container (if any).
        *
        * @param message Message to be logged
  @@ -686,24 +700,10 @@
        *
        * @param session Session to be recycled
        */
  -    void recycle(StandardSession session) {
  +    void recycle(Session session) {
   
   	synchronized (recycled) {
   	    recycled.add(session);
  -	}
  -
  -    }
  -
  -
  -    /**
  -     * Remove this Session from the active Sessions for this Manager.
  -     *
  -     * @param session Session to be removed
  -     */
  -    void remove(StandardSession session) {
  -
  -	synchronized (sessions) {
  -	    sessions.remove(session.getId());
   	}
   
       }