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

2004-05-22 Thread markt
markt   2004/05/22 16:21:10

  Modified:catalina/src/share/org/apache/catalina/session
StoreBase.java
  Log:
  Fix bug 19034. After a change to a class, sessions in the store may throw
exceptions as the serialised class is not longer compatible with the new
class. The bug describes an issue when InvalidClassException was
thrown. An apparently related bug (22716) referred to a
NotSerializableException so to be on the safe side I implemented a
solution that catches all exceptions.
The patch is based on a solution suggested by Ronald Klop.
This patch is untested as I was unable to reproduce the exception
described on my development machine.
  
  Revision  ChangesPath
  1.9   +13 -11
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StoreBase.java
  
  Index: StoreBase.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StoreBase.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StoreBase.java30 Apr 2004 19:15:26 -  1.8
  +++ StoreBase.java22 May 2004 23:21:10 -  1.9
  @@ -67,9 +67,9 @@
   import java.beans.PropertyChangeListener;
   import java.beans.PropertyChangeSupport;
   import java.io.IOException;
  +
   import org.apache.catalina.Container;
   import org.apache.catalina.Lifecycle;
  -import org.apache.catalina.LifecycleEvent;
   import org.apache.catalina.LifecycleException;
   import org.apache.catalina.LifecycleListener;
   import org.apache.catalina.Logger;
  @@ -328,12 +328,14 @@
   }
   remove(session.getId());
   }
  -} catch (IOException e) {
  -log (e.toString());
  -e.printStackTrace();
  -} catch (ClassNotFoundException e) {
  -log (e.toString());
  -e.printStackTrace();
  +} catch (Exception e) {
  +log (Session: +keys[i]+; +e.toString());
  +try {
  +remove(keys[i]);
  +} catch (IOException e2) {
  +log (e2.toString());
  +e2.printStackTrace();
  +}
   }
   }
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



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

2002-08-28 Thread bobh

bobh2002/08/28 10:08:58

  Modified:catalina/src/share/org/apache/catalina/session
StoreBase.java PersistentManagerBase.java
  Log:
  Currently when backup's of sessions expire they take out the session in RAM
  along with them.  This patch fixes this problem.
  
  Revision  ChangesPath
  1.6   +11 -5 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StoreBase.java
  
  Index: StoreBase.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StoreBase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StoreBase.java9 Jun 2002 02:19:43 -   1.5
  +++ StoreBase.java28 Aug 2002 17:08:58 -  1.6
  @@ -313,7 +313,13 @@
   int timeIdle = // Truncate, do not round up
   (int) ((timeNow - session.getLastAccessedTime()) / 1000L);
   if (timeIdle = maxInactiveInterval) {
  -session.expire();
  +if ( ( (PersistentManagerBase) manager).isLoaded( keys[i] )) {
  +// recycle old backup session
  +session.recycle();
  +} else {
  +// expire swapped out session
  +session.expire();
  +}
   remove(session.getId());
   }
   } catch (IOException e) {
  
  
  
  1.9   +24 -4 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/PersistentManagerBase.java
  
  Index: PersistentManagerBase.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/PersistentManagerBase.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PersistentManagerBase.java9 Jun 2002 02:19:43 -   1.8
  +++ PersistentManagerBase.java28 Aug 2002 17:08:58 -  1.9
  @@ -551,6 +551,26 @@
   
   
   /**
  + * Return true, if the session id is loaded in memory
  + * otherwise false is returned
  + *
  + * @param id The session id for the session to be searched for
  + *
  + * @exception IOException if an input/output error occurs while
  + *  processing this request
  + */
  +public boolean isLoaded( String id ){
  +try {
  +if ( super.findSession(id) != null )
  +return true;
  +} catch (IOException e) {
  +log(checking isLoaded for id,  + id + , +e.getMessage(), e);
  +}
  +return false;
  +}
  +
  +
  +/**
* Return the active Session, associated with this Manager, with the
* specified session id (if any); otherwise return codenull/code.
* This method checks the persistence store if persistence is enabled,
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




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

2001-04-25 Thread bip

bip 01/04/25 18:36:06

  Added:   catalina/src/share/org/apache/catalina/session
StoreBase.java
  Log:
  Moved common code from FileStore/JDBCStore into StoreBase. Extended
  by the concrete Store implementations like FileStore.
  
  Each Store now have the ability to implement their own processExpires()
  and storeStart()/storeStop().
  
  Revision  ChangesPath
  1.1  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StoreBase.java
  
  Index: StoreBase.java
  ===
  /*
   * StoreBase.java
   * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StoreBase.java,v
 1.1 2001/04/26 01:36:05 bip Exp $
   * $Revision: 1.1 $
   * $Date: 2001/04/26 01:36:05 $
   *
   * 
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *notice, this list of conditions and the following disclaimer in
   *the documentation and/or other materials provided with the
   *distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *any, must include the following acknowlegement:
   *   This product includes software developed by the
   *Apache Software Foundation (http://www.apache.org/).
   *Alternately, this acknowlegement may appear in the software itself,
   *if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names The Jakarta Project, Tomcat, and Apache Software
   *Foundation must not be used to endorse or promote products derived
   *from this software without prior written permission. For written
   *permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called Apache
   *nor may Apache appear in their names without prior written
   *permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * 
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * http://www.apache.org/.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  package org.apache.catalina.session;
  
  import java.beans.PropertyChangeListener;
  import java.beans.PropertyChangeSupport;
  import java.io.IOException;
  import org.apache.catalina.Container;
  import org.apache.catalina.Lifecycle;
  import org.apache.catalina.LifecycleEvent;
  import org.apache.catalina.LifecycleException;
  import org.apache.catalina.LifecycleException;
  import org.apache.catalina.LifecycleListener;
  import org.apache.catalina.Logger;
  import org.apache.catalina.Manager;
  import org.apache.catalina.Store;
  import org.apache.catalina.util.LifecycleSupport;
  import org.apache.catalina.util.StringManager;
  
  /**
   * Abstract implementation of the Store interface to
   * support most of the functionality required by a Store.
   *
   * @author Bip Thelin
   * @version $Revision: 1.1 $, $Date: 2001/04/26 01:36:05 $
   */
  
  public abstract class StoreBase
  implements Lifecycle, Runnable, Store {
  
  // - Instance Variables
  
  /**
   * The descriptive information about this implementation.
   */
  protected static String info = StoreBase/1.0;
  
  /**
   * The interval (in seconds) between checks for expired sessions.
   */
  protected int checkInterval = 60;
  
  /**
   * Name to