tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util InstanceSupport.java
Date Thu, 11 Oct 2001 23:30:58 GMT
craigmcc    01/10/11 16:30:58

  Modified:    catalina/src/share/org/apache/catalina InstanceEvent.java
               catalina/src/share/org/apache/catalina/core
                        ApplicationFilterChain.java StandardWrapper.java
               catalina/src/share/org/apache/catalina/util
                        InstanceSupport.java
  Log:
  Enhance InstanceEvent reporting to include any exception that was thrown
  during the process being reported by this event.  This applies to any of
  the "AFTER" events.
  
  Revision  Changes    Path
  1.7       +121 -4    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/InstanceEvent.java
  
  Index: InstanceEvent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/InstanceEvent.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- InstanceEvent.java	2001/08/01 03:04:04	1.6
  +++ InstanceEvent.java	2001/10/11 23:30:58	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/InstanceEvent.java,v
1.6 2001/08/01 03:04:04 craigmcc Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/08/01 03:04:04 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/InstanceEvent.java,v
1.7 2001/10/11 23:30:58 craigmcc Exp $
  + * $Revision: 1.7 $
  + * $Date: 2001/10/11 23:30:58 $
    *
    * ====================================================================
    *
  @@ -78,7 +78,7 @@
    * as opposed to the Wrapper component that manages it.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.6 $ $Date: 2001/08/01 03:04:04 $
  + * @version $Revision: 1.7 $ $Date: 2001/10/11 23:30:58 $
    */
   
   public final class InstanceEvent
  @@ -203,6 +203,28 @@
   
       /**
        * Construct a new InstanceEvent with the specified parameters.  This
  +     * constructor is used for filter lifecycle events.
  +     *
  +     * @param wrapper Wrapper managing this servlet instance
  +     * @param filter Filter instance for which this event occurred
  +     * @param type Event type (required)
  +     * @param exception Exception that occurred
  +     */
  +    public InstanceEvent(Wrapper wrapper, Filter filter, String type,
  +                         Throwable exception) {
  +
  +      super(wrapper);
  +      this.wrapper = wrapper;
  +      this.filter = filter;
  +      this.servlet = null;
  +      this.type = type;
  +      this.exception = exception;
  +
  +    }
  +
  +
  +    /**
  +     * Construct a new InstanceEvent with the specified parameters.  This
        * constructor is used for filter processing events.
        *
        * @param wrapper Wrapper managing this servlet instance
  @@ -227,6 +249,33 @@
   
       /**
        * Construct a new InstanceEvent with the specified parameters.  This
  +     * constructor is used for filter processing events.
  +     *
  +     * @param wrapper Wrapper managing this servlet instance
  +     * @param filter Filter instance for which this event occurred
  +     * @param type Event type (required)
  +     * @param request Servlet request we are processing
  +     * @param response Servlet response we are processing
  +     * @param exception Exception that occurred
  +     */
  +    public InstanceEvent(Wrapper wrapper, Filter filter, String type,
  +                         ServletRequest request, ServletResponse response,
  +                         Throwable exception) {
  +
  +      super(wrapper);
  +      this.wrapper = wrapper;
  +      this.filter = filter;
  +      this.servlet = null;
  +      this.type = type;
  +      this.request = request;
  +      this.response = response;
  +      this.exception = exception;
  +
  +    }
  +
  +
  +    /**
  +     * Construct a new InstanceEvent with the specified parameters.  This
        * constructor is used for processing servlet lifecycle events.
        *
        * @param wrapper Wrapper managing this servlet instance
  @@ -246,6 +295,28 @@
   
       /**
        * Construct a new InstanceEvent with the specified parameters.  This
  +     * constructor is used for processing servlet lifecycle events.
  +     *
  +     * @param wrapper Wrapper managing this servlet instance
  +     * @param servlet Servlet instance for which this event occurred
  +     * @param type Event type (required)
  +     * @param exception Exception that occurred
  +     */
  +    public InstanceEvent(Wrapper wrapper, Servlet servlet, String type,
  +                         Throwable exception) {
  +
  +      super(wrapper);
  +      this.wrapper = wrapper;
  +      this.filter = null;
  +      this.servlet = servlet;
  +      this.type = type;
  +      this.exception = exception;
  +
  +    }
  +
  +
  +    /**
  +     * Construct a new InstanceEvent with the specified parameters.  This
        * constructor is used for processing servlet processing events.
        *
        * @param wrapper Wrapper managing this servlet instance
  @@ -268,10 +339,45 @@
       }
   
   
  +    /**
  +     * Construct a new InstanceEvent with the specified parameters.  This
  +     * constructor is used for processing servlet processing events.
  +     *
  +     * @param wrapper Wrapper managing this servlet instance
  +     * @param servlet Servlet instance for which this event occurred
  +     * @param type Event type (required)
  +     * @param request Servlet request we are processing
  +     * @param response Servlet response we are processing
  +     * @param exception Exception that occurred
  +     */
  +    public InstanceEvent(Wrapper wrapper, Servlet servlet, String type,
  +                         ServletRequest request, ServletResponse response,
  +                         Throwable exception) {
  +
  +      super(wrapper);
  +      this.wrapper = wrapper;
  +      this.filter = null;
  +      this.servlet = servlet;
  +      this.type = type;
  +      this.request = request;
  +      this.response = response;
  +      this.exception = exception;
  +
  +    }
  +
  +
       // ----------------------------------------------------- Instance Variables
   
   
       /**
  +     * The exception that was thrown during the processing being reported
  +     * by this event (AFTER_INIT_EVENT, AFTER_SERVICE_EVENT, 
  +     * AFTER_DESTROY_EVENT, AFTER_DISPATCH_EVENT, and AFTER_FILTER_EVENT only).
  +     */
  +    private Throwable exception = null;
  +
  +
  +    /**
        * The Filter instance for which this event occurred (BEFORE_FILTER_EVENT
        * and AFTER_FILTER_EVENT only).
        */
  @@ -312,6 +418,17 @@
   
   
       // ------------------------------------------------------------- Properties
  +
  +
  +    /**
  +     * Return the exception that occurred during the processing
  +     * that was reported by this event.
  +     */
  +    public Throwable getException() {
  +
  +        return (this.exception);
  +
  +    }
   
   
       /**
  
  
  
  1.11      +12 -12    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java
  
  Index: ApplicationFilterChain.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ApplicationFilterChain.java	2001/07/30 20:35:49	1.10
  +++ ApplicationFilterChain.java	2001/10/11 23:30:58	1.11
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java,v
1.10 2001/07/30 20:35:49 craigmcc Exp $
  - * $Revision: 1.10 $
  - * $Date: 2001/07/30 20:35:49 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java,v
1.11 2001/10/11 23:30:58 craigmcc Exp $
  + * $Revision: 1.11 $
  + * $Date: 2001/10/11 23:30:58 $
    *
    * ====================================================================
    *
  @@ -92,7 +92,7 @@
    * method itself.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.10 $ $Date: 2001/07/30 20:35:49 $
  + * @version $Revision: 1.11 $ $Date: 2001/10/11 23:30:58 $
    */
   
   final class ApplicationFilterChain implements FilterChain {
  @@ -216,22 +216,22 @@
               } catch (IOException e) {
                   if (filter != null)
                       support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
  -                                              filter, request, response);
  +                                              filter, request, response, e);
                   throw e;
               } catch (ServletException e) {
                   if (filter != null)
                       support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
  -                                              filter, request, response);
  +                                              filter, request, response, e);
                   throw e;
               } catch (RuntimeException e) {
                   if (filter != null)
                       support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
  -                                              filter, request, response);
  +                                              filter, request, response, e);
                   throw e;
               } catch (Throwable e) {
                   if (filter != null)
                       support.fireInstanceEvent(InstanceEvent.AFTER_FILTER_EVENT,
  -                                              filter, request, response);
  +                                              filter, request, response, e);
                   throw new ServletException
                     (sm.getString("filterChain.filter"), e);
               }
  @@ -253,19 +253,19 @@
                                         servlet, request, response);
           } catch (IOException e) {
               support.fireInstanceEvent(InstanceEvent.AFTER_SERVICE_EVENT,
  -                                      servlet, request, response);
  +                                      servlet, request, response, e);
               throw e;
           } catch (ServletException e) {
               support.fireInstanceEvent(InstanceEvent.AFTER_SERVICE_EVENT,
  -                                      servlet, request, response);
  +                                      servlet, request, response, e);
               throw e;
           } catch (RuntimeException e) {
               support.fireInstanceEvent(InstanceEvent.AFTER_SERVICE_EVENT,
  -                                      servlet, request, response);
  +                                      servlet, request, response, e);
               throw e;
           } catch (Throwable e) {
               support.fireInstanceEvent(InstanceEvent.AFTER_SERVICE_EVENT,
  -                                      servlet, request, response);
  +                                      servlet, request, response, e);
               throw new ServletException
                 (sm.getString("filterChain.servlet"), e);
           }
  
  
  
  1.31      +8 -8      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapper.java
  
  Index: StandardWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- StandardWrapper.java	2001/09/28 03:24:07	1.30
  +++ StandardWrapper.java	2001/10/11 23:30:58	1.31
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v
1.30 2001/09/28 03:24:07 remm Exp $
  - * $Revision: 1.30 $
  - * $Date: 2001/09/28 03:24:07 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v
1.31 2001/10/11 23:30:58 craigmcc Exp $
  + * $Revision: 1.31 $
  + * $Date: 2001/10/11 23:30:58 $
    *
    * ====================================================================
    *
  @@ -105,7 +105,7 @@
    * make them efficient are counter-productive.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.30 $ $Date: 2001/09/28 03:24:07 $
  + * @version $Revision: 1.31 $ $Date: 2001/10/11 23:30:58 $
    */
   
   public final class StandardWrapper
  @@ -846,18 +846,18 @@
                                                 servlet);
           } catch (UnavailableException f) {
               instanceSupport.fireInstanceEvent(InstanceEvent.AFTER_INIT_EVENT,
  -                                              servlet);
  +                                              servlet, f);
               unavailable(f);
               throw f;
           } catch (ServletException f) {
               instanceSupport.fireInstanceEvent(InstanceEvent.AFTER_INIT_EVENT,
  -                                              servlet);
  +                                              servlet, f);
               // If the servlet wanted to be unavailable it would have
               // said so, so do not call unavailable(null).
               throw f;
           } catch (Throwable f) {
               instanceSupport.fireInstanceEvent(InstanceEvent.AFTER_INIT_EVENT,
  -                                              servlet);
  +                                              servlet, f);
               // If the servlet wanted to be unavailable it would have
               // said so, so do not call unavailable(null).
               throw new ServletException
  @@ -1005,7 +1005,7 @@
                 (InstanceEvent.AFTER_DESTROY_EVENT, instance);
           } catch (Throwable t) {
               instanceSupport.fireInstanceEvent
  -              (InstanceEvent.AFTER_DESTROY_EVENT, instance);
  +              (InstanceEvent.AFTER_DESTROY_EVENT, instance, t);
               instance = null;
               fireContainerEvent("unload", this);
               unloading = false;
  
  
  
  1.5       +120 -4    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/InstanceSupport.java
  
  Index: InstanceSupport.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/InstanceSupport.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- InstanceSupport.java	2001/07/30 20:35:49	1.4
  +++ InstanceSupport.java	2001/10/11 23:30:58	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/InstanceSupport.java,v
1.4 2001/07/30 20:35:49 craigmcc Exp $
  - * $Revision: 1.4 $
  - * $Date: 2001/07/30 20:35:49 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/util/InstanceSupport.java,v
1.5 2001/10/11 23:30:58 craigmcc Exp $
  + * $Revision: 1.5 $
  + * $Date: 2001/10/11 23:30:58 $
    *
    * ====================================================================
    *
  @@ -79,7 +79,7 @@
    * registered InstanceListeners.
    *
    * @author Craig R. McClanahan
  - * @version $Id: InstanceSupport.java,v 1.4 2001/07/30 20:35:49 craigmcc Exp $
  + * @version $Id: InstanceSupport.java,v 1.5 2001/10/11 23:30:58 craigmcc Exp $
    */
   
   public final class InstanceSupport {
  @@ -184,6 +184,33 @@
        *
        * @param type Event type
        * @param filter The relevant Filter for this event
  +     * @param exception Exception that occurred
  +     */
  +    public void fireInstanceEvent(String type, Filter filter,
  +                                  Throwable exception) {
  +
  +        if (listeners.length == 0)
  +            return;
  +
  +        InstanceEvent event = new InstanceEvent(wrapper, filter, type,
  +                                                exception);
  +        InstanceListener interested[] = null;
  +        synchronized (listeners) {
  +            interested = (InstanceListener[]) listeners.clone();
  +        }
  +        for (int i = 0; i < interested.length; i++)
  +            interested[i].instanceEvent(event);
  +
  +    }
  +
  +
  +    /**
  +     * Notify all lifecycle event listeners that a particular event has
  +     * occurred for this Container.  The default implementation performs
  +     * this notification synchronously using the calling thread.
  +     *
  +     * @param type Event type
  +     * @param filter The relevant Filter for this event
        * @param request The servlet request we are processing
        * @param response The servlet response we are processing
        */
  @@ -212,6 +239,37 @@
        * this notification synchronously using the calling thread.
        *
        * @param type Event type
  +     * @param filter The relevant Filter for this event
  +     * @param request The servlet request we are processing
  +     * @param response The servlet response we are processing
  +     * @param exception Exception that occurred
  +     */
  +    public void fireInstanceEvent(String type, Filter filter,
  +                                  ServletRequest request,
  +                                  ServletResponse response,
  +                                  Throwable exception) {
  +
  +        if (listeners.length == 0)
  +            return;
  +
  +        InstanceEvent event = new InstanceEvent(wrapper, filter, type,
  +                                                request, response, exception);
  +        InstanceListener interested[] = null;
  +        synchronized (listeners) {
  +            interested = (InstanceListener[]) listeners.clone();
  +        }
  +        for (int i = 0; i < interested.length; i++)
  +            interested[i].instanceEvent(event);
  +
  +    }
  +
  +
  +    /**
  +     * Notify all lifecycle event listeners that a particular event has
  +     * occurred for this Container.  The default implementation performs
  +     * this notification synchronously using the calling thread.
  +     *
  +     * @param type Event type
        * @param servlet The relevant Servlet for this event
        */
       public void fireInstanceEvent(String type, Servlet servlet) {
  @@ -237,6 +295,33 @@
        *
        * @param type Event type
        * @param servlet The relevant Servlet for this event
  +     * @param exception Exception that occurred
  +     */
  +    public void fireInstanceEvent(String type, Servlet servlet,
  +                                  Throwable exception) {
  +
  +        if (listeners.length == 0)
  +            return;
  +
  +        InstanceEvent event = new InstanceEvent(wrapper, servlet, type,
  +                                                exception);
  +        InstanceListener interested[] = null;
  +        synchronized (listeners) {
  +            interested = (InstanceListener[]) listeners.clone();
  +        }
  +        for (int i = 0; i < interested.length; i++)
  +            interested[i].instanceEvent(event);
  +
  +    }
  +
  +
  +    /**
  +     * Notify all lifecycle event listeners that a particular event has
  +     * occurred for this Container.  The default implementation performs
  +     * this notification synchronously using the calling thread.
  +     *
  +     * @param type Event type
  +     * @param servlet The relevant Servlet for this event
        * @param request The servlet request we are processing
        * @param response The servlet response we are processing
        */
  @@ -249,6 +334,37 @@
   
           InstanceEvent event = new InstanceEvent(wrapper, servlet, type,
                                                   request, response);
  +        InstanceListener interested[] = null;
  +        synchronized (listeners) {
  +            interested = (InstanceListener[]) listeners.clone();
  +        }
  +        for (int i = 0; i < interested.length; i++)
  +            interested[i].instanceEvent(event);
  +
  +    }
  +
  +
  +    /**
  +     * Notify all lifecycle event listeners that a particular event has
  +     * occurred for this Container.  The default implementation performs
  +     * this notification synchronously using the calling thread.
  +     *
  +     * @param type Event type
  +     * @param servlet The relevant Servlet for this event
  +     * @param request The servlet request we are processing
  +     * @param response The servlet response we are processing
  +     * @param exception Exception that occurred
  +     */
  +    public void fireInstanceEvent(String type, Servlet servlet,
  +                                  ServletRequest request,
  +                                  ServletResponse response,
  +                                  Throwable exception) {
  +
  +        if (listeners.length == 0)
  +            return;
  +
  +        InstanceEvent event = new InstanceEvent(wrapper, servlet, type,
  +                                                request, response, exception);
           InstanceListener interested[] = null;
           synchronized (listeners) {
               interested = (InstanceListener[]) listeners.clone();
  
  
  

Mime
View raw message