Author: markt
Date: Wed Dec 17 18:04:38 2014
New Revision: 1646302

URL: http://svn.apache.org/r1646302
Log:
Simplify. NioChannel.getAttachment(boolean) was only ever called with a 
parameter of false.

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
    tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
    tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
    tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java
    tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=1646302&r1=1646301&r2=1646302&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Wed Dec 
17 18:04:38 2014
@@ -99,7 +99,7 @@ public class Http11NioProcessor extends
 
     @Override
     protected void resetTimeouts() {
-        final NioEndpoint.NioSocketWrapper attach = 
(NioEndpoint.NioSocketWrapper)socketWrapper.getSocket().getAttachment(false);
+        final NioEndpoint.NioSocketWrapper attach = 
(NioEndpoint.NioSocketWrapper)socketWrapper.getSocket().getAttachment();
         if (!getErrorState().isError() && attach != null &&
                 asyncStateMachine.isAsyncDispatching()) {
             long soTimeout = endpoint.getSoTimeout();

Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java?rev=1646302&r1=1646301&r2=1646302&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java Wed 
Dec 17 18:04:38 2014
@@ -126,7 +126,7 @@ public class InternalNioInputBuffer exte
             }
             try {
                 NioEndpoint.NioSocketWrapper att =
-                        (NioEndpoint.NioSocketWrapper) 
socket.getAttachment(false);
+                        (NioEndpoint.NioSocketWrapper) socket.getAttachment();
                 if (att == null) {
                     throw new IOException("Key must be cancelled.");
                 }

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java?rev=1646302&r1=1646301&r2=1646302&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java Wed 
Dec 17 18:04:38 2014
@@ -126,7 +126,7 @@ public class InternalNioOutputBuffer ext
         }
 
         int written = 0;
-        NioEndpoint.NioSocketWrapper att = 
(NioEndpoint.NioSocketWrapper)socket.getAttachment(false);
+        NioEndpoint.NioSocketWrapper att = 
(NioEndpoint.NioSocketWrapper)socket.getAttachment();
         if ( att == null ) throw new IOException("Key must be cancelled");
         long writeTimeout = att.getWriteTimeout();
         Selector selector = null;
@@ -203,7 +203,7 @@ public class InternalNioOutputBuffer ext
             }
         }
 
-        NioEndpoint.NioSocketWrapper ka = 
(NioEndpoint.NioSocketWrapper)socket.getAttachment(false);
+        NioEndpoint.NioSocketWrapper ka = 
(NioEndpoint.NioSocketWrapper)socket.getAttachment();
         if (ka != null) ka.access();//prevent timeouts for just doing client 
writes
 
         if (!isBlocking() && length > 0) {
@@ -275,7 +275,7 @@ public class InternalNioOutputBuffer ext
 
     @Override
     protected void registerWriteInterest() throws IOException {
-        NioEndpoint.NioSocketWrapper att = 
(NioEndpoint.NioSocketWrapper)socket.getAttachment(false);
+        NioEndpoint.NioSocketWrapper att = 
(NioEndpoint.NioSocketWrapper)socket.getAttachment();
         if (att == null) {
             throw new IOException("Key must be cancelled");
         }

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java?rev=1646302&r1=1646301&r2=1646302&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioChannel.java Wed Dec 17 
18:04:38 2014
@@ -143,12 +143,11 @@ public class NioChannel implements ByteC
         return sc.read(dst);
     }
 
-    public Object getAttachment(boolean remove) {
+    public Object getAttachment() {
         Poller pol = getPoller();
         Selector sel = pol!=null?pol.getSelector():null;
         SelectionKey key = sel!=null?getIOChannel().keyFor(sel):null;
         Object att = key!=null?key.attachment():null;
-        if (key != null && att != null && remove ) key.attach(null);
         return att;
     }
 

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=1646302&r1=1646301&r2=1646302&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Wed Dec 17 
18:04:38 2014
@@ -868,7 +868,7 @@ public class NioEndpoint extends Abstrac
             }
             addEvent(r);
             if (close) {
-                NioEndpoint.NioSocketWrapper ka = 
(NioEndpoint.NioSocketWrapper)socket.getAttachment(false);
+                NioEndpoint.NioSocketWrapper ka = 
(NioEndpoint.NioSocketWrapper)socket.getAttachment();
                 processSocket(ka, SocketStatus.STOP, false);
             }
         }
@@ -1487,7 +1487,7 @@ public class NioEndpoint extends Abstrac
                 }
                 try {
                     NioEndpoint.NioSocketWrapper att =
-                            (NioEndpoint.NioSocketWrapper) 
channel.getAttachment(false);
+                            (NioEndpoint.NioSocketWrapper) 
channel.getAttachment();
                     if (att == null) {
                         throw new IOException("Key must be cancelled.");
                     }
@@ -1541,7 +1541,7 @@ public class NioEndpoint extends Abstrac
                 throws IOException {
 
             NioEndpoint.NioSocketWrapper att =
-                    (NioEndpoint.NioSocketWrapper) 
getSocket().getAttachment(false);
+                    (NioEndpoint.NioSocketWrapper) getSocket().getAttachment();
             if (att == null) {
                 throw new IOException("Key must be cancelled");
             }
@@ -1577,7 +1577,7 @@ public class NioEndpoint extends Abstrac
         @Override
         public void flush() throws IOException {
             NioEndpoint.NioSocketWrapper att =
-                    (NioEndpoint.NioSocketWrapper) 
getSocket().getAttachment(false);
+                    (NioEndpoint.NioSocketWrapper) getSocket().getAttachment();
             if (att == null) {
                 throw new IOException("Key must be cancelled");
             }



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

Reply via email to