fhanik      2004/01/12 17:39:36

  Modified:    catalina/src/share/org/apache/catalina Manager.java
               catalina/src/share/org/apache/catalina/core
                        StandardContext.java
  Log:
  Added in the method backgroundProcess() to the manager interface.
  This allows any context to invoke the method on any custom manager
  and allow the manager to have a thread less back ground process, for example for 
expiring sessions.
  The CVS diffs should be cleaner now, had to fix my IDE.
  
  Revision  Changes    Path
  1.6       +12 -4     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Manager.java
  
  Index: Manager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Manager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Manager.java      12 Jan 2004 18:44:04 -0000      1.5
  +++ Manager.java      13 Jan 2004 01:39:36 -0000      1.6
  @@ -259,6 +259,14 @@
        * @exception IOException if an input/output error occurs
        */
       public void unload() throws IOException;
  +    
  +     /**
  +      * This method will be invoked by the context/container on a periodic
  +      * basis and allows the manager to implement
  +      * a method that executes periodic tasks, such as expiring sessions etc.
  +      */
  +     public void backgroundProcess();
  +
   
   
   }
  
  
  
  1.107     +5 -7      
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.106
  retrieving revision 1.107
  diff -u -r1.106 -r1.107
  --- StandardContext.java      12 Jan 2004 18:44:04 -0000      1.106
  +++ StandardContext.java      13 Jan 2004 01:39:36 -0000      1.107
  @@ -4571,12 +4571,10 @@
           count = (count + 1) % managerChecksFrequency;
   
           if ((getManager() != null) && (count == 0)) {
  -            if (getManager() instanceof StandardManager) {
  -                ((StandardManager) getManager()).processExpires();
  -            } else if (getManager() instanceof PersistentManagerBase) {
  -                PersistentManagerBase pManager = 
  -                    (PersistentManagerBase) getManager();
  -                pManager.backgroundProcess();
  +            try {
  +                getManager().backgroundProcess();
  +            } catch ( Exception x ) {
  +                log.warn("Unable to perform background process on manager",x);
               }
           }
   
  
  
  

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

Reply via email to