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

2004-05-22 Thread markt
markt   2004/05/22 16:23:23

  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.
Ported from TC4
This patch is untested as I was unable to reproduce the exception
described on my development machine.
  
  Revision  ChangesPath
  1.8   +9 -7  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StoreBase.java
  
  Index: StoreBase.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StoreBase.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StoreBase.java27 Feb 2004 14:58:47 -  1.7
  +++ StoreBase.java22 May 2004 23:23:23 -  1.8
  @@ -228,12 +228,14 @@
   session.expire();
   }
   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-catalina/catalina/src/share/org/apache/catalina/session StoreBase.java

2003-08-19 Thread remm
remm2003/08/19 10:11:49

  Modified:catalina/src/share/org/apache/catalina/core
StandardContext.java
   catalina/src/share/org/apache/catalina/session
StoreBase.java
  Log:
  - Use the container provided background processing thread, rather than using one
for each store.
  
  Revision  ChangesPath
  1.84  +14 -4 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java
  
  Index: StandardContext.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
  retrieving revision 1.83
  retrieving revision 1.84
  diff -u -r1.83 -r1.84
  --- StandardContext.java  12 Aug 2003 16:15:52 -  1.83
  +++ StandardContext.java  19 Aug 2003 17:11:49 -  1.84
  @@ -126,7 +126,9 @@
   import org.apache.catalina.deploy.SecurityCollection;
   import org.apache.catalina.deploy.SecurityConstraint;
   import org.apache.catalina.loader.WebappLoader;
  +import org.apache.catalina.session.PersistentManagerBase;
   import org.apache.catalina.session.StandardManager;
  +import org.apache.catalina.session.StoreBase;
   import org.apache.catalina.util.CharsetMapper;
   import org.apache.catalina.util.ExtensionValidator;
   import org.apache.catalina.util.RequestUtil;
  @@ -4300,9 +4302,17 @@
   if (!started)
   return;
   
  -if ((getManager() != null) 
  - (getManager() instanceof StandardManager)) {
  -((StandardManager) getManager()).processExpires();
  +if (getManager() != null) {
  +if (getManager() instanceof StandardManager) {
  +((StandardManager) getManager()).processExpires();
  +} else if (getManager() instanceof PersistentManagerBase) {
  +PersistentManagerBase pManager = 
  +(PersistentManagerBase) getManager();
  +if ((pManager.getStore() != null) 
  + (pManager.getStore() instanceof StoreBase)) {
  +((StoreBase) pManager.getStore()).processExpires();
  +}
  +}
   }
   
   if (getLoader() != null) {
  
  
  
  1.5   +9 -109
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StoreBase.java
  
  Index: StoreBase.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StoreBase.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StoreBase.java19 Aug 2003 00:49:58 -  1.4
  +++ StoreBase.java19 Aug 2003 17:11:49 -  1.5
  @@ -87,7 +87,7 @@
*/
   
   public abstract class StoreBase
  -implements Lifecycle, Runnable, Store {
  +implements Lifecycle, Store {
   
   // - Instance Variables
   
  @@ -97,31 +97,11 @@
   protected static String info = StoreBase/1.0;
   
   /**
  - * The interval (in seconds) between checks for expired sessions.
  - */
  -protected int checkInterval = 60;
  -
  -/**
  - * Name to register for the background thread.
  - */
  -protected String threadName = StoreBase;
  -
  -/**
* Name to register for this Store, used for logging.
*/
   protected static String storeName = StoreBase;
   
   /**
  - * The background thread.
  - */
  -protected Thread thread = null;
  -
  -/**
  - * The background thread completion semaphore.
  - */
  -protected boolean threadDone = false;
  -
  -/**
* The debugging detail level for this component.
*/
   protected int debug = 0;
  @@ -160,12 +140,6 @@
   return(info);
   }
   
  -/**
  - * Return the thread name for this Store.
  - */
  -public String getThreadName() {
  -return(threadName);
  -}
   
   /**
* Return the name for this Store, used for logging.
  @@ -174,6 +148,7 @@
   return(storeName);
   }
   
  +
   /**
* Set the debugging detail level for this Store.
*
  @@ -192,26 +167,6 @@
   
   
   /**
  - * Set the check interval (in seconds) for this Store.
  - *
  - * @param checkInterval The new check interval
  - */
  -public void setCheckInterval(int checkInterval) {
  -int oldCheckInterval = this.checkInterval;
  -this.checkInterval = checkInterval;
  -support.firePropertyChange(checkInterval,
  -   new Integer(oldCheckInterval),
  -   new Integer(this.checkInterval));
  -}
  -
  -/**
  - * Return the check interval (in seconds) for this Store.
  - */
  -public int