tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator SingleSignOn.java
Date Wed, 30 Mar 2005 15:50:40 GMT
remm        2005/03/30 07:50:40

  Modified:    catalina/src/share/org/apache/catalina/session
                        StandardSession.java StandardManager.java
               catalina/src/share/org/apache/catalina Session.java
               catalina/src/share/org/apache/catalina/authenticator
                        SingleSignOn.java
  Log:
  - 33711: add events on passivate and activate to cleanup SSO.
  - Recycle sessions when passivating or expiring them. (risky change)
  
  Revision  Changes    Path
  1.56      +21 -8     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardSession.java
  
  Index: StandardSession.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardSession.java,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- StandardSession.java	25 Mar 2005 16:49:28 -0000	1.55
  +++ StandardSession.java	30 Mar 2005 15:50:40 -0000	1.56
  @@ -321,13 +321,20 @@
        */
       public String getId() {
   
  -        // Comment out for now, will revisit for 5.5.10
  -        /*
  -         if ( !isValid() ) {
  -             throw new IllegalStateException
  -                 (sm.getString("standardSession.getId.ise"));
  -         }
  -	 */
  +        /*if ( !isValid() ) {
  +            throw new IllegalStateException
  +            (sm.getString("standardSession.getId.ise"));
  +        }*/
  +
  +        return (this.id);
  +
  +    }
  +
  +
  +    /**
  +     * Return the session identifier for this session.
  +     */
  +    public String getIdInternal() {
   
           return (this.id);
   
  @@ -737,6 +744,9 @@
        */
       public void passivate() {
   
  +        // Notify interested session event listeners
  +        fireSessionEvent(Session.SESSION_PASSIVATED_EVENT, null);
  +
           // Notify ActivationListeners
           HttpSessionEvent event = null;
           String keys[] = keys();
  @@ -764,6 +774,9 @@
        */
       public void activate() {
   
  +        // Notify interested session event listeners
  +        fireSessionEvent(Session.SESSION_ACTIVATED_EVENT, null);
  +
           // Notify ActivationListeners
           HttpSessionEvent event = null;
           String keys[] = keys();
  
  
  
  1.29      +10 -4     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardManager.java
  
  Index: StandardManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardManager.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- StandardManager.java	7 Feb 2005 21:56:32 -0000	1.28
  +++ StandardManager.java	30 Mar 2005 15:50:40 -0000	1.29
  @@ -556,6 +556,8 @@
                   session.expire(false);
               } catch (Throwable t) {
                   ;
  +            } finally {
  +                session.recycle();
               }
           }
   
  @@ -670,12 +672,16 @@
           Session sessions[] = findSessions();
           for (int i = 0; i < sessions.length; i++) {
               StandardSession session = (StandardSession) sessions[i];
  -            if (!session.isValid())
  -                continue;
               try {
  -                session.expire();
  +                if (session.isValid()) {
  +                    session.expire();
  +                }
               } catch (Throwable t) {
                   ;
  +            } finally {
  +                // Measure against memory leaking if references to the session
  +                // object are kept in a shared field somewhere
  +                session.recycle();
               }
           }
   
  
  
  
  1.5       +13 -1     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Session.java
  
  Index: Session.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Session.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Session.java	27 Feb 2004 14:58:39 -0000	1.4
  +++ Session.java	30 Mar 2005 15:50:40 -0000	1.5
  @@ -51,6 +51,18 @@
       public static final String SESSION_DESTROYED_EVENT = "destroySession";
   
   
  +    /**
  +     * The SessionEvent event type when a session is activated.
  +     */
  +    public static final String SESSION_ACTIVATED_EVENT = "activateSession";
  +
  +
  +    /**
  +     * The SessionEvent event type when a session is passivated.
  +     */
  +    public static final String SESSION_PASSIVATED_EVENT = "passivateSession";
  +
  +
       // ------------------------------------------------------------- Properties
   
   
  
  
  
  1.23      +6 -4      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/SingleSignOn.java
  
  Index: SingleSignOn.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/SingleSignOn.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- SingleSignOn.java	23 Feb 2005 19:27:56 -0000	1.22
  +++ SingleSignOn.java	30 Mar 2005 15:50:40 -0000	1.23
  @@ -275,7 +275,8 @@
       public void sessionEvent(SessionEvent event) {
   
           // We only care about session destroyed events
  -        if (!Session.SESSION_DESTROYED_EVENT.equals(event.getType()))
  +        if (!Session.SESSION_DESTROYED_EVENT.equals(event.getType())
  +                && (!Session.SESSION_PASSIVATED_EVENT.equals(event.getType())))
               return;
   
           // Look up the single session id associated with this session (if any)
  @@ -294,9 +295,10 @@
           // If so, we'll just remove the expired session from the
           // SSO.  If the session was logged out, we'll log out
           // of all session associated with the SSO.
  -        if ((session.getMaxInactiveInterval() > 0)
  +        if (((session.getMaxInactiveInterval() > 0)
               && (System.currentTimeMillis() - session.getLastAccessedTime() >=
  -                session.getMaxInactiveInterval() * 1000)) {
  +                session.getMaxInactiveInterval() * 1000)) 
  +            || (Session.SESSION_PASSIVATED_EVENT.equals(event.getType()))) {
               removeSession(ssoId, session);
           } else {
               // The session was logged out.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message