tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1713251 - in /tomcat/trunk/java/org/apache: coyote/http11/ tomcat/util/net/
Date Sun, 08 Nov 2015 16:53:01 GMT
Author: markt
Date: Sun Nov  8 16:53:00 2015
New Revision: 1713251

URL: http://svn.apache.org/viewvc?rev=1713251&view=rev
Log:
Pull up handler field to AbstractEndpoint

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
    tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Protocol.java
    tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
    tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
    tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
    tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
    tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java?rev=1713251&r1=1713250&r2=1713251&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java Sun Nov  8 16:53:00
2015
@@ -37,7 +37,7 @@ public class Http11AprProtocol extends A
         super(new AprEndpoint());
         Http11ConnectionHandler<Long> cHandler = new Http11ConnectionHandler<>(this);
         setHandler(cHandler);
-        ((AprEndpoint) getEndpoint()).setHandler(cHandler);
+        getEndpoint().setHandler(cHandler);
     }
 
 

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Protocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Protocol.java?rev=1713251&r1=1713250&r2=1713251&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Protocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Protocol.java Sun Nov  8 16:53:00
2015
@@ -34,7 +34,7 @@ public class Http11Nio2Protocol extends
         super(new Nio2Endpoint());
         Http11ConnectionHandler<Nio2Channel> cHandler = new Http11ConnectionHandler<>(this);
         setHandler(cHandler);
-        ((Nio2Endpoint) getEndpoint()).setHandler(cHandler);
+        getEndpoint().setHandler(cHandler);
     }
 
 

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java?rev=1713251&r1=1713250&r2=1713251&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java Sun Nov  8 16:53:00
2015
@@ -39,7 +39,7 @@ public class Http11NioProtocol extends A
         super(new NioEndpoint());
         Http11ConnectionHandler<NioChannel> cHandler = new Http11ConnectionHandler<>(this);
         setHandler(cHandler);
-        ((NioEndpoint) getEndpoint()).setHandler(cHandler);
+        getEndpoint().setHandler(cHandler);
     }
 
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java?rev=1713251&r1=1713250&r2=1713251&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java Sun Nov  8 16:53:00
2015
@@ -533,6 +533,15 @@ public abstract class AbstractEndpoint<S
         return (negotiableProtocols.size() > 0);
     }
 
+
+    /**
+     * Handling of accepted sockets.
+     */
+    private Handler<S> handler = null;
+    public void setHandler(Handler<S> handler ) { this.handler = handler; }
+    public Handler<S> getHandler() { return handler; }
+
+
     /**
      * Attributes provide a way for configuration to be passed to sub-components
      * without the {@link org.apache.coyote.ProtocolHandler} being aware of the
@@ -849,9 +858,6 @@ public abstract class AbstractEndpoint<S
         }
     }
 
-
-    protected abstract Handler<S> getHandler();
-
     protected abstract Log getLog();
 
     protected LimitLatch initializeConnectionLatch() {

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1713251&r1=1713250&r2=1713251&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Sun Nov  8 16:53:00 2015
@@ -134,15 +134,6 @@ public class AprEndpoint extends Abstrac
 
 
     /**
-     * Handling of accepted sockets.
-     */
-    protected Handler<Long> handler = null;
-    public void setHandler(Handler<Long> handler ) { this.handler = handler; }
-    @Override
-    public Handler<Long> getHandler() { return handler; }
-
-
-    /**
      * Poll interval, in microseconds. The smaller the value, the more CPU the poller
      * will use, but the more responsive to activity it will be.
      */
@@ -617,7 +608,7 @@ public class AprEndpoint extends Abstrac
             for (SocketWrapperBase<Long> socketWrapper : connections.values()) {
                 try {
                     socketWrapper.close();
-                    handler.release(socketWrapper);
+                    getHandler().release(socketWrapper);
                 } catch (IOException e) {
                     // Ignore
                 }
@@ -701,7 +692,7 @@ public class AprEndpoint extends Abstrac
             rootPool = 0;
         }
 
-        handler.recycle();
+        getHandler().recycle();
     }
 
 
@@ -2250,7 +2241,7 @@ public class AprEndpoint extends Abstrac
                         return;
                     }
                     // Process the request from this socket
-                    Handler.SocketState state = handler.process(socket,
+                    Handler.SocketState state = getHandler().process(socket,
                             SocketStatus.OPEN_READ);
                     if (state == Handler.SocketState.CLOSED) {
                         // Close socket and pool
@@ -2293,7 +2284,7 @@ public class AprEndpoint extends Abstrac
                     // Closed in another thread
                     return;
                 }
-                SocketState state = handler.process(socket, status);
+                SocketState state = getHandler().process(socket, status);
                 if (state == Handler.SocketState.CLOSED) {
                     // Close socket and pool
                     closeSocket(socket.getSocket().longValue());

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1713251&r1=1713250&r2=1713251&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Sun Nov  8 16:53:00 2015
@@ -106,15 +106,6 @@ public class Nio2Endpoint extends Abstra
 
     // ------------------------------------------------------------- Properties
 
-    /**
-     * Handling of accepted sockets.
-     */
-    private Handler<Nio2Channel> handler = null;
-    public void setHandler(Handler<Nio2Channel> handler ) { this.handler = handler;
}
-    @Override
-    public Handler<Nio2Channel> getHandler() { return handler; }
-
-
     public void setSocketProperties(SocketProperties socketProperties) {
         this.socketProperties = socketProperties;
     }
@@ -155,9 +146,12 @@ public class Nio2Endpoint extends Abstra
     protected void releaseCaches() {
         this.nioChannels.clear();
         this.processorCache.clear();
-        if ( handler != null ) handler.recycle();
+        if (getHandler() != null) {
+            getHandler().recycle();
+        }
     }
 
+
     // --------------------------------------------------------- Public Methods
 
     /**
@@ -254,7 +248,7 @@ public class Nio2Endpoint extends Abstra
                 public void run() {
                     // Then close all active connections if any remain
                     try {
-                        for (Nio2Channel channel : handler.getOpenSockets()) {
+                        for (Nio2Channel channel : getHandler().getOpenSockets()) {
                             closeSocket(channel.getSocket());
                         }
                     } catch (Throwable t) {
@@ -419,7 +413,7 @@ public class Nio2Endpoint extends Abstra
             return;
         }
         try {
-            handler.release(socket);
+            getHandler().release(socket);
         } catch (Throwable e) {
             ExceptionUtils.handleThrowable(e);
             if (log.isDebugEnabled()) log.error("",e);
@@ -1670,9 +1664,9 @@ public class Nio2Endpoint extends Abstra
                         SocketState state = SocketState.OPEN;
                         // Process the request from this socket
                         if (status == null) {
-                            state = handler.process(socket, SocketStatus.OPEN_READ);
+                            state = getHandler().process(socket, SocketStatus.OPEN_READ);
                         } else {
-                            state = handler.process(socket, status);
+                            state = getHandler().process(socket, status);
                         }
                         if (state == SocketState.CLOSED) {
                             // Close socket and pool

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1713251&r1=1713250&r2=1713251&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Sun Nov  8 16:53:00 2015
@@ -140,15 +140,6 @@ public class NioEndpoint extends Abstrac
 
 
     /**
-     * Handling of accepted sockets.
-     */
-    private Handler<NioChannel> handler = null;
-    public void setHandler(Handler<NioChannel> handler ) { this.handler = handler;
}
-    @Override
-    public Handler<NioChannel> getHandler() { return handler; }
-
-
-    /**
      * Poller thread count.
      */
     private int pollerThreadCount = Math.min(2,Runtime.getRuntime().availableProcessors());
@@ -214,8 +205,9 @@ public class NioEndpoint extends Abstrac
     protected void releaseCaches() {
         this.nioChannels.clear();
         this.processorCache.clear();
-        if ( handler != null ) handler.recycle();
-
+        if (getHandler() != null ) {
+            getHandler().recycle();
+        }
     }
 
 
@@ -774,7 +766,7 @@ public class NioEndpoint extends Abstrac
                 if (ka != null) {
                     // If attachment is non-null then there may be a current
                     // connection with an associated processor.
-                    handler.release(ka);
+                    getHandler().release(ka);
                 }
                 if (key.isValid()) key.cancel();
                 if (key.channel().isOpen()) {
@@ -1518,9 +1510,9 @@ public class NioEndpoint extends Abstrac
                         SocketState state = SocketState.OPEN;
                         // Process the request from this socket
                         if (status == null) {
-                            state = handler.process(ka, SocketStatus.OPEN_READ);
+                            state = getHandler().process(ka, SocketStatus.OPEN_READ);
                         } else {
-                            state = handler.process(ka, status);
+                            state = getHandler().process(ka, status);
                         }
                         if (state == SocketState.CLOSED) {
                             close(socket, key);



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


Mime
View raw message