tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/webapps/docs changelog.xml
Date Tue, 26 Jul 2005 12:45:22 GMT
remm        2005/07/26 05:45:22

  Modified:    catalina/src/share/org/apache/catalina/valves ValveBase.java
                        ErrorReportValve.java mbeans-descriptors.xml
               catalina build.xml
               webapps/docs changelog.xml
  Added:       catalina/src/share/org/apache/catalina/valves
                        SemaphoreValve.java
  Log:
  - Add a simple valve for concurrency control, with a conditional compilation
    flag.
  - At the moment, this will not be shipped in the release (needs Java 5).
  - Update changelog.
  
  Revision  Changes    Path
  1.19      +15 -1     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ValveBase.java
  
  Index: ValveBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ValveBase.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ValveBase.java	2 Mar 2005 20:19:58 -0000	1.18
  +++ ValveBase.java	26 Jul 2005 12:45:22 -0000	1.19
  @@ -178,6 +178,20 @@
       public abstract void invoke(Request request, Response response)
           throws IOException, ServletException;
   
  +
  +    /**
  +     * Return a String rendering of this object.
  +     */
  +    public String toString() {
  +        StringBuffer sb = new StringBuffer(this.getClass().getName());
  +        sb.append("[");
  +        if (container != null)
  +            sb.append(container.getName());
  +        sb.append("]");
  +        return (sb.toString());
  +    }
  +
  +
       // -------------------- JMX and Registration  --------------------
       protected String domain;
       protected ObjectName oname;
  
  
  
  1.26      +1 -14     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ErrorReportValve.java
  
  Index: ErrorReportValve.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ErrorReportValve.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- ErrorReportValve.java	21 Jan 2005 13:11:02 -0000	1.25
  +++ ErrorReportValve.java	26 Jul 2005 12:45:22 -0000	1.26
  @@ -141,19 +141,6 @@
       }
   
   
  -    /**
  -     * Return a String rendering of this object.
  -     */
  -    public String toString() {
  -
  -        StringBuffer sb = new StringBuffer("ErrorReportValve[");
  -        sb.append(container.getName());
  -        sb.append("]");
  -        return (sb.toString());
  -
  -    }
  -
  -
       // ------------------------------------------------------ Protected Methods
   
   
  
  
  
  1.10      +25 -0     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/mbeans-descriptors.xml
  
  Index: mbeans-descriptors.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/mbeans-descriptors.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- mbeans-descriptors.xml	19 Nov 2004 20:06:07 -0000	1.9
  +++ mbeans-descriptors.xml	26 Jul 2005 12:45:22 -0000	1.10
  @@ -234,6 +234,31 @@
                  type="java.lang.String"/>
     </mbean>
   
  +  <mbean name="SemaphoreValve"
  +         description="Valve that does concurrency control"
  +         domain="Catalina"
  +         group="Valve"
  +         type="org.apache.catalina.valves.SemaphoreValve">
  +
  +    <attribute name="className"
  +               description="Fully qualified class name of the managed object"
  +               type="java.lang.String"
  +               writeable="false"/>
  +
  +    <attribute name="containerName"
  +               description="Object name of the container"
  +               type="javax.management.ObjectName"/>
  +
  +    <attribute name="concurrency"
  +               description="Desired concurrency level"
  +               type="int"/>
  +
  +    <attribute name="fairness"
  +               description="Use a fair semaphore"
  +               type="boolean"/>
  +
  +  </mbean>
  +
     <mbean name="RemoteAddrValve"
            description="Concrete implementation of RequestFilterValve that  filters based
on the string representation of the remote client's IP address"
            domain="Catalina"
  
  
  
  1.1                  jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/SemaphoreValve.java
  
  Index: SemaphoreValve.java
  ===================================================================
  /*
   * Copyright 1999-2001,2005 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  
  package org.apache.catalina.valves;
  
  
  import java.io.IOException;
  import java.util.concurrent.Semaphore;
  
  import javax.servlet.ServletException;
  
  import org.apache.catalina.connector.Request;
  import org.apache.catalina.connector.Response;
  
  
  /**
   * <p>Implementation of a Valve that limits concurrency.</p>
   *
   * <p>This Valve may be attached to any Container, depending on the granularity
   * of the concurrency control you wish to perform.</p>
   *
   * @author Remy Maucherat
   * @version $Revision: 1.1 $ $Date: 2005/07/26 12:45:22 $
   */
  
  public class SemaphoreValve
      extends ValveBase {
  
  
      // ------------------------------------------------------------ Constructor
  
  
      /**
       * Create a new StandardHost component with the default basic Valve.
       */
      public SemaphoreValve() {
          semaphore = new Semaphore(concurrency, fairness);
      }
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The descriptive information related to this implementation.
       */
      private static final String info =
          "org.apache.catalina.valves.SemaphoreValve/1.0";
  
  
      /**
       * Semaphore.
       */
      protected Semaphore semaphore = null;
      
  
      // ------------------------------------------------------------- Properties
  
      
      /**
       * Concurrency level of the semaphore.
       */
      protected int concurrency = 10;
      public int getConcurrency() { return concurrency; }
      public void setConcurrency(int concurrency) { this.concurrency = concurrency; }
      
  
      /**
       * Fairness of the semaphore.
       */
      protected boolean fairness = false;
      public boolean getFairness() { return fairness; }
      public void setFairness(boolean fairness) { this.fairness = fairness; }
      
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Return descriptive information about this Valve implementation.
       */
      public String getInfo() {
          return (info);
      }
  
  
      /**
       * Do concurrency control on the request using the semaphore.
       *
       * @param request The servlet request to be processed
       * @param response The servlet response to be created
       *
       * @exception IOException if an input/output error occurs
       * @exception ServletException if a servlet error occurs
       */
      public void invoke(Request request, Response response)
          throws IOException, ServletException {
  
          try {
              semaphore.acquireUninterruptibly();
              // Perform the request
              getNext().invoke(request, response);
          } finally {
              semaphore.release();
          }
  
      }
  
  
  }
  
  
  
  1.83      +7 -0      jakarta-tomcat-catalina/catalina/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/build.xml,v
  retrieving revision 1.82
  retrieving revision 1.83
  diff -u -r1.82 -r1.83
  --- build.xml	24 Jun 2005 17:18:36 -0000	1.82
  +++ build.xml	26 Jul 2005 12:45:22 -0000	1.83
  @@ -128,6 +128,8 @@
       <available property="jdk.1.3.present" 
        classname="java.lang.reflect.Proxy" />
       <available property="jdk.1.4.present" classname="java.nio.Buffer" />
  +    <available property="jdk.1.5.present" 
  +     classname="java.util.concurrent.Semaphore" />
   
       <!-- Ant flags -->
       <available property="style.available"
  @@ -618,6 +620,7 @@
         <exclude name="org/apache/naming/factory/MailSessionFactory.java"/>
         <exclude name="org/apache/naming/factory/SendMailFactory.java"/>
         <exclude name="org/apache/catalina/launcher/**"/>
  +      <exclude name="org/apache/catalina/valves/SemaphoreValve.java"/>
       </javac>
       <tstamp>
           <format property="TODAY" pattern="MMM d yyyy" locale="en"/>
  @@ -659,6 +662,8 @@
          unless="compile.javamail"/>
         <exclude name="org/apache/catalina/valves/CertificatesValve.java"
          unless="compile.jsse"/>
  +      <exclude name="org/apache/catalina/valves/SemaphoreValve.java" 
  +       unless="jdk.1.5.present"/>
       </javac>
   
       <!-- Copy static resource files -->
  @@ -976,6 +981,7 @@
           <exclude name="org/apache/catalina/valves/Remote*" />
           <exclude name="org/apache/catalina/valves/RequestDumperValve.class" />
           <exclude name="org/apache/catalina/valves/RequestFilterValve.class" />
  +        <exclude name="org/apache/catalina/valves/SemaphoreValve.class" />
   
         </fileset>
       </jar>
  @@ -1010,6 +1016,7 @@
           <include name="org/apache/catalina/valves/Remote*" />
           <include name="org/apache/catalina/valves/RequestDumperValve.class" />
           <include name="org/apache/catalina/valves/RequestFilterValve.class" />
  +        <include name="org/apache/catalina/valves/SemaphoreValve.class" />
   
           <!-- Javadoc and i18n exclusions -->
           <exclude name="**/package.html" />
  
  
  
  1.338     +45 -0     jakarta-tomcat-catalina/webapps/docs/changelog.xml
  
  Index: changelog.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/changelog.xml,v
  retrieving revision 1.337
  retrieving revision 1.338
  diff -u -r1.337 -r1.338
  --- changelog.xml	22 Jul 2005 21:25:44 -0000	1.337
  +++ changelog.xml	26 Jul 2005 12:45:22 -0000	1.338
  @@ -26,6 +26,51 @@
     </p>
   </section>
   
  +<section name="Tomcat 5.5.11 (yoavs)">
  +  <subsection name="General">
  +    <changelog>
  +      <update>
  +        Update to Xerces 1.7.0 (remm)
  +      </update>
  +    </changelog>
  +  </subsection>
  +  
  +  <subsection name="Catalina">
  +    <changelog>
  +      <add>
  +        Add concurrency control valve (o.a.c.valves.SemaphoreValve). As the Tomcat distribution

  +        is not built for Java 5, the valve will have to be compiled from the sources 
  +        using Java 5 (remm)
  +      </add>
  +    </changelog>
  +  </subsection>
  +  
  +   <subsection name="Coyote">
  +     <changelog>
  +      <fix>
  +        Fix default ports for http and https which are set in the request when the parsed
  +        hostname does not specify the port, and which were inverted (https was set as 80

  +        and http as 443). (remm)
  +      </fix>
  +     </changelog>
  +  </subsection>
  +
  +  <subsection name="Jasper">
  +    <changelog>
  +    </changelog>
  +  </subsection>
  +  
  +  <subsection name="Cluster">
  +    <changelog>        
  +     </changelog>
  +  </subsection>
  +  
  +  <subsection name="Webapps">
  +    <changelog>
  +    </changelog>
  +  </subsection>
  + </section>
  +
   <section name="Tomcat 5.5.10 (yoavs)">
     <subsection name="General">
       <changelog>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message