2 Replies Latest reply on Jul 21, 2004 6:41 PM by benstarr

    Filter not returning from chain.doFilter

    benstarr Newbie

      I have a filter that is designed to count the number of current requests being handle by Tomcat. The doFilter method looks something like:

      public void doFilter(...) throws ... {
       // increment count here
      
       try {
       chain.doFilter(request, response);
       }
       finally {
       // decrement count here
       }
      }


      The calls to increment and decrement are synchronized. However, when the server is idle the count does not return to zero. This leads me to believe that either:

      a) The chain.doFilter method is never returning for some reason
      b) The thread is being terminated in the chain.doFilter method

      I can't think of a reason why a) would ever be the case. Does anyone know whether the container (Tomcat 4.1.x) will do b) in any scenario? I can't seem to correlate it to the user hitting the stop button in the browser or being redirected within the chain.doFilter method and I can't see why this would stop the method returning anyway. Any help would be appreciated.