You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2011/11/10 06:52:23 UTC

svn commit: r1200167 - in /tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net: AbstractEndpoint.java AprEndpoint.java DefaultServerSocketFactory.java JIoEndpoint.java ServerSocketFactory.java SocketProperties.java SocketStatus.java SocketWrapper.java

Author: kkolinko
Date: Thu Nov 10 05:52:22 2011
New Revision: 1200167

URL: http://svn.apache.org/viewvc?rev=1200167&view=rev
Log:
Merging revision 1187781 from tomcat/trunk:
Whitespace removal from /java/org/apache/tomcat
I won't merge all of it (as it spans bcel etc.), but only our code.
Part 4.

Modified:
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/DefaultServerSocketFactory.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/ServerSocketFactory.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/SocketProperties.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/SocketStatus.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java?rev=1200167&r1=1200166&r2=1200167&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java Thu Nov 10 05:52:22 2011
@@ -56,14 +56,14 @@ public abstract class AbstractEndpoint {
             //      ASYNC_END (if possible)
             OPEN, CLOSED, LONG, ASYNC_END, SENDFILE
         }
-        
+
 
         /**
          * Obtain the GlobalRequestProcessor associated with the handler.
          */
         public Object getGlobal();
-        
-        
+
+
         /**
          * Recycle resources associated with the handler.
          */
@@ -179,7 +179,7 @@ public abstract class AbstractEndpoint {
      * Controls when the Endpoint binds the port. <code>true</code>, the default
      * binds the port on {@link #init()} and unbinds it on {@link #destroy()}.
      * If set to <code>false</code> the port is bound on {@link #start()} and
-     * unbound on {@link #stop()}.  
+     * unbound on {@link #stop()}.
      */
     private boolean bindOnInit = true;
     public boolean getBindOnInit() { return bindOnInit; }
@@ -323,7 +323,7 @@ public abstract class AbstractEndpoint {
      */
     protected HashMap<String, Object> attributes =
         new HashMap<String, Object>();
-    /** 
+    /**
      * Generic property setter called when a property for which a specific
      * setter already exists within the
      * {@link org.apache.coyote.ProtocolHandler} needs to be made available to
@@ -368,7 +368,7 @@ public abstract class AbstractEndpoint {
     public String getProperty(String name) {
         return (String) getAttribute(name);
     }
-    
+
     /**
      * Return the amount of threads that are managed by the pool.
      *
@@ -516,7 +516,7 @@ public abstract class AbstractEndpoint {
             bindState = BindState.BOUND_ON_INIT;
         }
     }
-    
+
     public final void start() throws Exception {
         if (bindState == BindState.UNBOUND) {
             bind();
@@ -593,25 +593,25 @@ public abstract class AbstractEndpoint {
     public abstract boolean getUseComet();
     public abstract boolean getUseCometTimeout();
     public abstract boolean getUsePolling();
-    
+
     protected LimitLatch initializeConnectionLatch() {
         if (connectionLimitLatch==null) {
             connectionLimitLatch = new LimitLatch(getMaxConnections());
         }
         return connectionLimitLatch;
     }
-    
+
     protected void releaseConnectionLatch() {
         LimitLatch latch = connectionLimitLatch;
         if (latch!=null) latch.releaseAll();
         connectionLimitLatch = null;
     }
-    
+
     protected void countUpOrAwaitConnection() throws InterruptedException {
         LimitLatch latch = connectionLimitLatch;
         if (latch!=null) latch.countUpOrAwait();
     }
-    
+
     protected long countDownConnection() {
         LimitLatch latch = connectionLimitLatch;
         if (latch!=null) {
@@ -622,14 +622,14 @@ public abstract class AbstractEndpoint {
             return result;
         } else return -1;
     }
-    
+
     /**
      * Provides a common approach for sub-classes to handle exceptions where a
      * delay is required to prevent a Thread from entering a tight loop which
      * will consume CPU and may also trigger large amounts of logging. For
      * example, this can happen with the Acceptor thread if the ulimit for open
      * files is reached.
-     * 
+     *
      * @param currentErrorDelay The current delay beign applied on failure
      * @return  The delay to apply on the next failure
      */
@@ -642,7 +642,7 @@ public abstract class AbstractEndpoint {
                 // Ignore
             }
         }
-        
+
         // On subsequent exceptions, start the delay at 50ms, doubling the delay
         // on every subsequent exception until the delay reaches 1.6 seconds.
         if (currentErrorDelay == 0) {

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1200167&r1=1200166&r2=1200167&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Thu Nov 10 05:52:22 2011
@@ -581,7 +581,7 @@ public class AprEndpoint extends Abstrac
             if (getExecutor() == null) {
                 createExecutor();
             }
-            
+
             initializeConnectionLatch();
 
             // Start poller threads
@@ -988,7 +988,7 @@ public class AprEndpoint extends Abstrac
                 try {
                     //if we have reached max connections, wait
                     countUpOrAwaitConnection();
-                    
+
                     long socket = 0;
                     try {
                         // Accept the next incoming connection from the server
@@ -1107,7 +1107,7 @@ public class AprEndpoint extends Abstrac
 
         private long[] addSocket;
         private boolean[] addSocketKeepAlive;
-        
+
         private volatile int addCount = 0;
 
         private boolean comet = true;

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/DefaultServerSocketFactory.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/DefaultServerSocketFactory.java?rev=1200167&r1=1200166&r2=1200167&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/DefaultServerSocketFactory.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/DefaultServerSocketFactory.java Thu Nov 10 05:52:22 2011
@@ -32,7 +32,7 @@ import java.net.Socket;
 public class DefaultServerSocketFactory implements ServerSocketFactory {
 
     /**
-     * 
+     *
      * @param endpoint  Unused in this implementation.
      */
     public DefaultServerSocketFactory(AbstractEndpoint endpoint) {

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java?rev=1200167&r1=1200166&r2=1200167&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java Thu Nov 10 05:52:22 2011
@@ -63,7 +63,7 @@ public class JIoEndpoint extends Abstrac
      * Associated server socket.
      */
     protected ServerSocket serverSocket = null;
-    
+
 
     // ------------------------------------------------------------ Constructor
 
@@ -81,7 +81,7 @@ public class JIoEndpoint extends Abstrac
     protected int acceptorThreadCount = 0;
     public void setAcceptorThreadCount(int acceptorThreadCount) { this.acceptorThreadCount = acceptorThreadCount; }
     public int getAcceptorThreadCount() { return acceptorThreadCount; }
-    
+
     /**
      * Handling of accepted sockets.
      */
@@ -122,7 +122,7 @@ public class JIoEndpoint extends Abstrac
     public interface Handler extends AbstractEndpoint.Handler {
         public SocketState process(SocketWrapper<Socket> socket,
                 SocketStatus status);
-        public SSLImplementation getSslImplementation(); 
+        public SSLImplementation getSslImplementation();
     }
 
 
@@ -155,7 +155,7 @@ public class JIoEndpoint extends Abstrac
                         processSocketAsync(socket,SocketStatus.TIMEOUT);
                     }
                 }
-                
+
                 // Loop if endpoint is paused
                 while (paused && running) {
                     try {
@@ -164,12 +164,12 @@ public class JIoEndpoint extends Abstrac
                         // Ignore
                     }
                 }
-                
+
             }
         }
     }
 
-    
+
     // --------------------------------------------------- Acceptor Inner Class
     /**
      * Server socket acceptor thread.
@@ -204,7 +204,7 @@ public class JIoEndpoint extends Abstrac
                 try {
                     //if we have reached max connections, wait
                     countUpOrAwaitConnection();
-                    
+
                     Socket socket = null;
                     try {
                         // Accept the next incoming connection from the server
@@ -264,10 +264,10 @@ public class JIoEndpoint extends Abstrac
      * external Executor thread pool.
      */
     protected class SocketProcessor implements Runnable {
-        
+
         protected SocketWrapper<Socket> socket = null;
         protected SocketStatus status = null;
-        
+
         public SocketProcessor(SocketWrapper<Socket> socket) {
             if (socket==null) throw new NullPointerException();
             this.socket = socket;
@@ -296,7 +296,7 @@ public class JIoEndpoint extends Abstrac
                         // Tell to close the socket
                         state = SocketState.CLOSED;
                     }
-                        
+
                     if ((state != SocketState.CLOSED)) {
                         if (status == null) {
                             state = handler.process(socket, SocketStatus.OPEN);
@@ -339,7 +339,7 @@ public class JIoEndpoint extends Abstrac
             socket = null;
             // Finish up this request
         }
-        
+
     }
 
 
@@ -388,9 +388,9 @@ public class JIoEndpoint extends Abstrac
                 throw be;
             }
         }
-        
+
     }
-    
+
     @Override
     public void startInternal() throws Exception {
 
@@ -402,7 +402,7 @@ public class JIoEndpoint extends Abstrac
             if (getExecutor() == null) {
                 createExecutor();
             }
-            
+
             initializeConnectionLatch();
 
             // Start acceptor threads
@@ -413,7 +413,7 @@ public class JIoEndpoint extends Abstrac
                 acceptorThread.setDaemon(getDaemon());
                 acceptorThread.start();
             }
-            
+
             // Start async timeout thread
             Thread timeoutThread = new Thread(new AsyncTimeout(),
                     getName() + "-AsyncTimeout");
@@ -480,14 +480,14 @@ public class JIoEndpoint extends Abstrac
         return true;
     }
 
-    
+
     /**
      * Process a new connection from a new client. Wraps the socket so
      * keep-alive and other attributes can be tracked and then passes the socket
      * to the executor for processing.
-     * 
+     *
      * @param socket    The socket associated with the client.
-     * 
+     *
      * @return          <code>true</code> if the socket is passed to the
      *                  executor, <code>false</code> if something went wrong or
      *                  if the endpoint is shutting down. Returning
@@ -516,12 +516,12 @@ public class JIoEndpoint extends Abstrac
         }
         return true;
     }
-    
-    
+
+
     /**
      * Process an existing async connection. If processing is required, passes
      * the wrapped socket to an executor for processing.
-     * 
+     *
      * @param socket    The socket associated with the client.
      * @param status    Only OPEN and TIMEOUT are used. The others are used for
      *                  Comet requests that are not supported by the BIO (JIO)
@@ -595,5 +595,5 @@ public class JIoEndpoint extends Abstrac
             return null;
         }
     }
-    
+
 }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/ServerSocketFactory.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/ServerSocketFactory.java?rev=1200167&r1=1200166&r2=1200167&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/ServerSocketFactory.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/ServerSocketFactory.java Thu Nov 10 05:52:22 2011
@@ -23,7 +23,7 @@ import java.net.Socket;
 
 /**
  * The common interface through which the {@link JIoEndpoint} interacts with
- * both non-SSL and SSL sockets. 
+ * both non-SSL and SSL sockets.
  */
 public interface ServerSocketFactory {
 
@@ -31,7 +31,7 @@ public interface ServerSocketFactory {
      * Returns a server socket which uses all network interfaces on the host,
      * and is bound to a the specified port. The socket is configured with the
      * socket options (such as accept timeout) given to this factory.
-     * 
+     *
      * @param port
      *            the port to listen to
      * @exception IOException
@@ -47,7 +47,7 @@ public interface ServerSocketFactory {
      * bound to a the specified port, and uses the specified connection backlog.
      * The socket is configured with the socket options (such as accept timeout)
      * given to this factory.
-     * 
+     *
      * @param port
      *            the port to listen to
      * @param backlog
@@ -65,7 +65,7 @@ public interface ServerSocketFactory {
      * on the local host, is bound to a the specified port, and uses the
      * specified connection backlog. The socket is configured with the socket
      * options (such as accept timeout) given to this factory.
-     * 
+     *
      * @param port
      *            the port to listen to
      * @param backlog
@@ -83,14 +83,14 @@ public interface ServerSocketFactory {
     /**
      * Wrapper function for accept(). This allows us to trap and translate
      * exceptions if necessary.
-     * 
+     *
      * @exception IOException
      */
     Socket acceptSocket(ServerSocket socket) throws IOException;
 
     /**
      * Triggers the SSL handshake. This will be a no-op for non-SSL sockets.
-     * 
+     *
      * @exception IOException
      */
     void handshake(Socket sock) throws IOException;

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/SocketProperties.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/SocketProperties.java?rev=1200167&r1=1200166&r2=1200167&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/SocketProperties.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/SocketProperties.java Thu Nov 10 05:52:22 2011
@@ -36,7 +36,7 @@ public class SocketProperties {
      * 0 is disabled
      */
     protected int keyCache = 500;
-    
+
     /**
      * Enable/disable socket processor cache, this bounded cache stores
      * SocketProcessor objects to reduce GC
@@ -49,7 +49,7 @@ public class SocketProperties {
     /**
      * Enable/disable poller event cache, this bounded cache stores
      * PollerEvent objects to reduce GC for the poller
-     * Default is 500 
+     * Default is 500
      * -1 is unlimited
      * 0 is disabled
      * >0 the max number of objects to keep in cache.
@@ -171,13 +171,13 @@ public class SocketProperties {
      * used.
      */
     protected Integer performanceBandwidth = null;
-    
+
     /**
      * The minimum frequency of the timeout interval to avoid excess load from
      * the poller during high traffic
      */
     protected long timeoutInterval = 1000;
-    
+
     /**
      * Timeout in milliseconds for an unlock to take place.
      */
@@ -226,7 +226,7 @@ public class SocketProperties {
             socket.setSoTimeout(soTimeout.intValue());
     }
 
-    
+
     public boolean getDirectBuffer() {
         return directBuffer;
     }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/SocketStatus.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/SocketStatus.java?rev=1200167&r1=1200166&r2=1200167&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/SocketStatus.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/SocketStatus.java Thu Nov 10 05:52:22 2011
@@ -18,8 +18,8 @@
 package org.apache.tomcat.util.net;
 
 /**
- * Someone, please change the enum name. 
- * 
+ * Someone, please change the enum name.
+ *
  * @author remm
  */
 public enum SocketStatus {

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java?rev=1200167&r1=1200166&r2=1200167&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/SocketWrapper.java Thu Nov 10 05:52:22 2011
@@ -17,9 +17,9 @@
 package org.apache.tomcat.util.net;
 
 public class SocketWrapper<E> {
-    
+
     protected volatile E socket;
-    
+
     protected volatile long lastAccess = -1;
     protected long timeout = -1;
     protected boolean error = false;
@@ -27,15 +27,15 @@ public class SocketWrapper<E> {
     protected volatile int keepAliveLeft = 100;
     protected boolean async = false;
     protected boolean keptAlive = false;
-    
+
     public SocketWrapper(E socket) {
         this.socket = socket;
     }
-    
+
     public E getSocket() {
         return socket;
     }
-    
+
     public boolean isAsync() { return async; }
     public void setAsync(boolean async) { this.async = async; }
     public long getLastAccess() { return lastAccess; }



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