Author: markt
Date: Wed Apr 13 18:50:50 2016
New Revision: 1738983

URL: http://svn.apache.org/viewvc?rev=1738983&view=rev
Log:
Code clean-up.

Modified:
    tomcat/tc8.5.x/trunk/   (props changed)
    tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/LocalStrings.properties
    tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java
    tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
    tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java

Propchange: tomcat/tc8.5.x/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Apr 13 18:50:50 2016
@@ -1 +1 @@
-/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175,1738261,1738589,1738623-1738625,1738643,1738816,1738850,1738855
+/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175,1738261,1738589,1738623-1738625,1738643,1738816,1738850,1738855,1738946-1738948,1738953-1738954,1738979

Modified: 
tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/LocalStrings.properties?rev=1738983&r1=1738982&r2=1738983&view=diff
==============================================================================
--- 
tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/LocalStrings.properties 
(original)
+++ 
tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/LocalStrings.properties 
Wed Apr 13 18:50:50 2016
@@ -74,6 +74,7 @@ endpoint.apr.tooManyCertFiles=More certi
 endpoint.apr.remoteport=APR socket [{0}] opened with remote port [{1}]
 endpoint.jsse.cannotHonorServerCipherOrder=The Java Runtime does not support 
"useServerCipherSuitesOrder" with JSSE. You must use OpenSSL or Java 8 onwards 
to use this feature.
 endpoint.jsse.noSslContext=No SSLContext could be found for the host name [{0}]
+endpoint.nio.registerFail=Failed to register socket with selector from poller
 endpoint.nio.selectorCloseFail=Failed to close selector when closing the poller
 endpoint.nio.timeoutCme=Exception during processing of timeouts. The code has 
been checked repeatedly and no concurrent modification has been found. If you 
are able to repeat this error please open a Tomcat bug and provide the steps to 
reproduce.
 endpoint.nio2.exclusiveExecutor=The NIO2 connector requires an exclusive 
executor to operate properly on shutdown

Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java?rev=1738983&r1=1738982&r2=1738983&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java 
(original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java Wed 
Apr 13 18:50:50 2016
@@ -40,7 +40,7 @@ public class NioChannel implements ByteC
     protected static final ByteBuffer emptyBuf = ByteBuffer.allocate(0);
 
     protected SocketChannel sc = null;
-    protected SocketWrapperBase<NioChannel> socket = null;
+    protected SocketWrapperBase<NioChannel> socketWrapper = null;
 
     protected final SocketBufferHandler bufHandler;
 
@@ -61,8 +61,8 @@ public class NioChannel implements ByteC
     }
 
 
-    void setSocketWrapper(SocketWrapperBase<NioChannel> socket) {
-        this.socket = socket;
+    void setSocketWrapper(SocketWrapperBase<NioChannel> socketWrapper) {
+        this.socketWrapper = socketWrapper;
     }
 
     /**

Modified: tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1738983&r1=1738982&r2=1738983&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java 
(original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Wed 
Apr 13 18:50:50 2016
@@ -597,16 +597,16 @@ public class NioEndpoint extends Abstrac
 
         private NioChannel socket;
         private int interestOps;
-        private NioSocketWrapper key;
+        private NioSocketWrapper socketWrapper;
 
-        public PollerEvent(NioChannel ch, NioSocketWrapper k, int intOps) {
-            reset(ch, k, intOps);
+        public PollerEvent(NioChannel ch, NioSocketWrapper w, int intOps) {
+            reset(ch, w, intOps);
         }
 
-        public void reset(NioChannel ch, NioSocketWrapper k, int intOps) {
+        public void reset(NioChannel ch, NioSocketWrapper w, int intOps) {
             socket = ch;
             interestOps = intOps;
-            key = k;
+            socketWrapper = w;
         }
 
         public void reset() {
@@ -615,22 +615,23 @@ public class NioEndpoint extends Abstrac
 
         @Override
         public void run() {
-            if ( interestOps == OP_REGISTER ) {
+            if (interestOps == OP_REGISTER) {
                 try {
-                    
socket.getIOChannel().register(socket.getPoller().getSelector(), 
SelectionKey.OP_READ, key);
+                    socket.getIOChannel().register(
+                            socket.getPoller().getSelector(), 
SelectionKey.OP_READ, socketWrapper);
                 } catch (Exception x) {
-                    log.error("", x);
+                    log.error(sm.getString("endpoint.nio.registerFail"), x);
                 }
             } else {
                 final SelectionKey key = 
socket.getIOChannel().keyFor(socket.getPoller().getSelector());
                 try {
                     boolean cancel = false;
                     if (key != null) {
-                        final NioSocketWrapper att = (NioSocketWrapper) 
key.attachment();
-                        if ( att!=null ) {
+                        final NioSocketWrapper socketWrapper = 
(NioSocketWrapper) key.attachment();
+                        if (socketWrapper != null) {
                             //we are registering the key to start with, reset 
the fairness counter.
                             int ops = key.interestOps() | interestOps;
-                            att.interestOps(ops);
+                            socketWrapper.interestOps(ops);
                             key.interestOps(ops);
                         } else {
                             cancel = true;
@@ -638,18 +639,19 @@ public class NioEndpoint extends Abstrac
                     } else {
                         cancel = true;
                     }
-                    if ( cancel ) socket.getPoller().cancelledKey(key);
-                }catch (CancelledKeyException ckx) {
+                    if (cancel) socket.getPoller().cancelledKey(key);
+                } catch (CancelledKeyException ckx) {
                     try {
                         socket.getPoller().cancelledKey(key);
-                    }catch (Exception ignore) {}
+                    } catch (Exception ignore) {}
                 }
-            }//end if
-        }//run
+            }
+        }
 
         @Override
         public String toString() {
-            return super.toString()+"[intOps="+this.interestOps+"]";
+            return "Poller event: socket [" + socket + "], socketWrapper [" + 
socketWrapper +
+                    "], interstOps [" + interestOps + "]";
         }
     }
 

Modified: 
tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java?rev=1738983&r1=1738982&r2=1738983&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java 
(original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/SecureNioChannel.java 
Wed Apr 13 18:50:50 2016
@@ -186,7 +186,8 @@ public class SecureNioChannel extends Ni
                 }
                 case FINISHED: {
                     if (endpoint.hasNegotiableProtocols() && sslEngine 
instanceof SSLUtil.ProtocolInfo) {
-                        socket.setNegotiatedProtocol(((SSLUtil.ProtocolInfo) 
sslEngine).getNegotiatedProtocol());
+                        socketWrapper.setNegotiatedProtocol(
+                                ((SSLUtil.ProtocolInfo) 
sslEngine).getNegotiatedProtocol());
                     }
                     //we are complete if we have delivered the last package
                     handshakeComplete = !netOutBuffer.hasRemaining();
@@ -567,11 +568,11 @@ public class SecureNioChannel extends Ni
                 } else {
                     // The SSL session has increased the required buffer size
                     // since the buffer was created.
-                    if (dst == 
socket.getSocketBufferHandler().getReadBuffer()) {
+                    if (dst == 
socketWrapper.getSocketBufferHandler().getReadBuffer()) {
                         // This is the normal case for this code
-                        socket.getSocketBufferHandler().expand(
+                        socketWrapper.getSocketBufferHandler().expand(
                                 
sslEngine.getSession().getApplicationBufferSize());
-                        dst = socket.getSocketBufferHandler().getReadBuffer();
+                        dst = 
socketWrapper.getSocketBufferHandler().getReadBuffer();
                     } else {
                         // Can't expand the buffer as there is no way to signal
                         // to the caller that the buffer has been replaced.



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

Reply via email to