Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/RequestFilterValve.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/RequestFilterValve.java?rev=1187022&r1=1187021&r2=1187022&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/RequestFilterValve.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/RequestFilterValve.java 
Thu Oct 20 19:55:37 2011
@@ -5,17 +5,15 @@
  * The ASF licenses this file to You 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;
 
 
@@ -59,9 +57,7 @@ import org.apache.catalina.connector.Res
  * @author Craig R. McClanahan
  * @version $Id$
  */
-
-public abstract class RequestFilterValve
-    extends ValveBase {
+public abstract class RequestFilterValve extends ValveBase {
 
     //------------------------------------------------------ Constructor
     public RequestFilterValve() {

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/SSLValve.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/SSLValve.java?rev=1187022&r1=1187021&r2=1187022&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/SSLValve.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/SSLValve.java Thu Oct 
20 19:55:37 2011
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.catalina.valves;
 
 import java.io.ByteArrayInputStream;
@@ -39,10 +38,10 @@ import org.apache.juli.logging.LogFactor
  * In httpd, mod_headers is used to add the SSL information as HTTP headers. In
  * Tomcat, this valve is used to read the information from the HTTP headers and
  * insert it into the request.<p>
- * 
+ *
  * <b>Note: Ensure that the headers are always set by httpd for all requests to
  * prevent a client spoofing SSL information by sending fake headers. </b><p>
- * 
+ *
  * In httpd.conf add the following:
  * <pre>
  * &lt;IfModule ssl_module&gt;
@@ -52,7 +51,7 @@ import org.apache.juli.logging.LogFactor
  *   RequestHeader set SSL_CIPHER_USEKEYSIZE "%{SSL_CIPHER_USEKEYSIZE}s"
  * &lt;/IfModule&gt;
  * </pre>
- * 
+ *
  * In server.xml, configure this valve under the Engine element in server.xml:
  * <pre>
  * &lt;Engine ...&gt;
@@ -62,10 +61,10 @@ import org.apache.juli.logging.LogFactor
  * </pre>
  */
 public class SSLValve extends ValveBase {
-    
+
     private static final Log log = LogFactory.getLog(SSLValve.class);
 
-    
+
     //------------------------------------------------------ Constructor
     public SSLValve() {
         super(true);
@@ -75,13 +74,15 @@ public class SSLValve extends ValveBase 
 
     public String mygetHeader(Request request, String header) {
         String strcert0 = request.getHeader(header);
-        if (strcert0 == null)
+        if (strcert0 == null) {
             return null;
+        }
         /* mod_header writes "(null)" when the ssl variable is no filled */
-        if ("(null)".equals(strcert0))
+        if ("(null)".equals(strcert0)) {
             return null;
+        }
         return strcert0;
-    } 
+    }
     @Override
     public void invoke(Request request, Response response)
         throws IOException, ServletException {
@@ -103,7 +104,7 @@ public class SSLValve extends ValveBase 
             try {
                 CertificateFactory cf;
                 if (providerName == null) {
-                    cf = CertificateFactory.getInstance("X.509");    
+                    cf = CertificateFactory.getInstance("X.509");
                 } else {
                     cf = CertificateFactory.getInstance("X.509", providerName);
                 }

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/SemaphoreValve.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/SemaphoreValve.java?rev=1187022&r1=1187021&r2=1187022&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/SemaphoreValve.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/SemaphoreValve.java 
Thu Oct 20 19:55:37 2011
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You 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.
@@ -60,18 +60,18 @@ public class SemaphoreValve extends Valv
      * 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.
@@ -79,7 +79,7 @@ public class SemaphoreValve extends Valv
     protected boolean fairness = false;
     public boolean getFairness() { return fairness; }
     public void setFairness(boolean fairness) { this.fairness = fairness; }
-    
+
 
     /**
      * Block until a permit is available.
@@ -87,7 +87,7 @@ public class SemaphoreValve extends Valv
     protected boolean block = true;
     public boolean getBlock() { return block; }
     public void setBlock(boolean block) { this.block = block; }
-    
+
 
     /**
      * Block interruptibly until a permit is available.
@@ -95,7 +95,7 @@ public class SemaphoreValve extends Valv
     protected boolean interruptible = false;
     public boolean getInterruptible() { return interruptible; }
     public void setInterruptible(boolean interruptible) { this.interruptible = 
interruptible; }
-    
+
 
     /**
      * Start this component and implement the requirements
@@ -106,7 +106,7 @@ public class SemaphoreValve extends Valv
      */
     @Override
     protected synchronized void startInternal() throws LifecycleException {
-        
+
         semaphore = new Semaphore(concurrency, fairness);
 
         setState(LifecycleState.STARTING);
@@ -128,7 +128,7 @@ public class SemaphoreValve extends Valv
         semaphore = null;
     }
 
-    
+
     // --------------------------------------------------------- Public Methods
 
 
@@ -165,7 +165,7 @@ public class SemaphoreValve extends Valv
                             shouldRelease = false;
                             permitDenied(request, response);
                             return;
-                        }  
+                        }
                     } else {
                         semaphore.acquireUninterruptibly();
                     }
@@ -188,22 +188,22 @@ public class SemaphoreValve extends Valv
 
     }
 
-    
+
     /**
      * Subclass friendly method to add conditions.
-     * @param request 
-     * @param response 
+     * @param request
+     * @param response
      */
     public boolean controlConcurrency(Request request, Response response) {
         return true;
     }
-    
+
 
     /**
      * Subclass friendly method to add error handling when a permit isn't
      * granted.
-     * @param request 
-     * @param response 
+     * @param request
+     * @param response
      * @throws IOException
      * @throws ServletException
      */
@@ -211,6 +211,6 @@ public class SemaphoreValve extends Valv
         throws IOException, ServletException {
         // NO-OP by default
     }
-    
+
 
 }

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/StuckThreadDetectionValve.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/StuckThreadDetectionValve.java?rev=1187022&r1=1187021&r2=1187022&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/StuckThreadDetectionValve.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/StuckThreadDetectionValve.java
 Thu Oct 20 19:55:37 2011
@@ -38,7 +38,7 @@ import org.apache.tomcat.util.res.String
  * This valve allows to detect requests that take a long time to process, 
which might
  * indicate that the thread that is processing it is stuck.
  * Based on code proposed by TomLu in Bugzilla entry #50306
- * 
+ *
  * @author slaurent
  *
  */
@@ -53,7 +53,7 @@ public class StuckThreadDetectionValve e
      * Logger
      */
     private static final Log log = 
LogFactory.getLog(StuckThreadDetectionValve.class);
-    
+
     /**
      * The string manager for this package.
      */
@@ -64,30 +64,30 @@ public class StuckThreadDetectionValve e
      * Keeps count of the number of stuck threads detected
      */
     private final AtomicInteger stuckCount = new AtomicInteger(0);
-    
+
     /**
      * In seconds. Default 600 (10 minutes).
      */
     private int threshold = 600;
-    
+
     /**
      * The only references we keep to actual running Thread objects are in
      * this Map (which is automatically cleaned in invoke()s finally clause).
      * That way, Threads can be GC'ed, eventhough the Valve still thinks they
      * are stuck (caused by a long monitor interval)
      */
-    private ConcurrentHashMap<Long, MonitoredThread> activeThreads =
+    private final ConcurrentHashMap<Long, MonitoredThread> activeThreads =
             new ConcurrentHashMap<Long, MonitoredThread>();
     /**
      *
      */
-    private Queue<CompletedStuckThread> completedStuckThreadsQueue =
+    private final Queue<CompletedStuckThread> completedStuckThreadsQueue =
             new ConcurrentLinkedQueue<CompletedStuckThread>();
 
     /**
      * Specify the threshold (in seconds) used when checking for stuck threads.
      * If &lt;=0, the detection is disabled. The default is 600 seconds.
-     * 
+     *
      * @param threshold
      *            The new threshold in seconds
      */
@@ -103,7 +103,7 @@ public class StuckThreadDetectionValve e
         return threshold;
     }
 
-    
+
     /**
      * Required to enable async support.
      */
@@ -166,7 +166,7 @@ public class StuckThreadDetectionValve e
     @Override
     public void invoke(Request request, Response response)
             throws IOException, ServletException {
-        
+
         if (threshold <= 0) {
             // short-circuit if not monitoring stuck threads
             getNext().invoke(request, response);
@@ -183,7 +183,7 @@ public class StuckThreadDetectionValve e
             requestUrl.append("?");
             requestUrl.append(request.getQueryString());
         }
-        MonitoredThread monitoredThread = new 
MonitoredThread(Thread.currentThread(), 
+        MonitoredThread monitoredThread = new 
MonitoredThread(Thread.currentThread(),
             requestUrl.toString());
         activeThreads.put(key, monitoredThread);
 
@@ -216,7 +216,7 @@ public class StuckThreadDetectionValve e
             }
         }
         // Check if any threads previously reported as stuck, have finished.
-        for (CompletedStuckThread completedStuckThread = 
completedStuckThreadsQueue.poll(); 
+        for (CompletedStuckThread completedStuckThread = 
completedStuckThreadsQueue.poll();
             completedStuckThread != null; completedStuckThread = 
completedStuckThreadsQueue.poll()) {
 
             int numStuckThreads = stuckCount.decrementAndGet();
@@ -224,7 +224,7 @@ public class StuckThreadDetectionValve e
                     completedStuckThread.getTotalActiveTime(), 
numStuckThreads);
         }
     }
-    
+
     public long[] getStuckThreadIds() {
         List<Long> idList = new ArrayList<Long>();
         for (MonitoredThread monitoredThread : activeThreads.values()) {
@@ -282,7 +282,7 @@ public class StuckThreadDetectionValve e
             int val = 
this.state.getAndSet(MonitoredThreadState.DONE.ordinal());
             return MonitoredThreadState.values()[val];
         }
-        
+
         boolean isMarkedAsStuck() {
             return this.state.get() == MonitoredThreadState.STUCK.ordinal();
         }
@@ -290,8 +290,8 @@ public class StuckThreadDetectionValve e
 
     private static class CompletedStuckThread {
 
-        private String threadName;
-        private long totalActiveTime;
+        private final String threadName;
+        private final long totalActiveTime;
 
         public CompletedStuckThread(String threadName, long totalActiveTime) {
             this.threadName = threadName;

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/ValveBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/ValveBase.java?rev=1187022&r1=1187021&r2=1187022&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/ValveBase.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/valves/ValveBase.java Thu Oct 
20 19:55:37 2011
@@ -5,17 +5,15 @@
  * The ASF licenses this file to You 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;
 
 
@@ -53,11 +51,11 @@ public abstract class ValveBase extends 
     implements Contained, Valve {
 
     //------------------------------------------------------ Constructor
-    
+
     public ValveBase() {
         this(false);
     }
-    
+
     public ValveBase(boolean asyncSupported) {
         this.asyncSupported = asyncSupported;
     }
@@ -67,7 +65,7 @@ public abstract class ValveBase extends 
      * Does this valve support Servlet 3+ async requests?
      */
     protected boolean asyncSupported;
-    
+
     /**
      * The Container whose pipeline this Valve is a component of.
      */
@@ -103,7 +101,7 @@ public abstract class ValveBase extends 
 
     //-------------------------------------------------------------- Properties
 
-    
+
     /**
      * Return the Container with which this Valve is associated, if any.
      */
@@ -208,7 +206,7 @@ public abstract class ValveBase extends 
 
     /**
      * Process a Comet event. This method will rarely need to be provided by
-     * a subclass, unless it needs to reassociate a particular object with 
+     * a subclass, unless it needs to reassociate a particular object with
      * the thread that is processing the request.
      *
      * @param request The servlet request to be processed
@@ -230,11 +228,11 @@ public abstract class ValveBase extends 
     @Override
     protected void initInternal() throws LifecycleException {
         super.initInternal();
-        
+
         containerLog = getContainer().getLogger();
     }
-    
-    
+
+
     /**
      * Start this component and implement the requirements
      * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
@@ -244,7 +242,7 @@ public abstract class ValveBase extends 
      */
     @Override
     protected synchronized void startInternal() throws LifecycleException {
-        
+
         setState(LifecycleState.STARTING);
     }
 
@@ -261,8 +259,8 @@ public abstract class ValveBase extends 
 
         setState(LifecycleState.STOPPING);
     }
-    
-    
+
+
     /**
      * Return a String rendering of this object.
      */
@@ -284,13 +282,13 @@ public abstract class ValveBase extends 
     @Override
     public String getObjectNameKeyProperties() {
         StringBuilder name = new StringBuilder("type=Valve");
-        
+
         Container container = getContainer();
 
         name.append(MBeanUtils.getContainerKeyProperties(container));
-        
+
         int seq = 0;
-        
+
         // Pipeline may not be present in unit testing
         Pipeline p = container.getPipeline();
         if (p != null) {
@@ -310,7 +308,7 @@ public abstract class ValveBase extends 
                 }
             }
         }
-        
+
         if (seq > 0) {
             name.append(",seq=");
             name.append(seq);
@@ -323,7 +321,7 @@ public abstract class ValveBase extends 
         }
         name.append(",name=");
         name.append(className);
-        
+
         return name.toString();
     }
 



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

Reply via email to