Author: markt Date: Wed Dec 17 18:09:30 2014 New Revision: 1646303 URL: http://svn.apache.org/r1646303 Log: Use the provided atomic method to replace the attachment and return a reference to the old value rather than doing the same thing in a thread unsafe manner.
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java 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=1646303&r1=1646302&r2=1646303&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:09:30 2014 @@ -921,8 +921,7 @@ public class NioEndpoint extends Abstrac public void cancelledKey(SelectionKey key) { try { if ( key == null ) return;//nothing to do - NioSocketWrapper ka = (NioSocketWrapper) key.attachment(); - key.attach(null); + NioSocketWrapper ka = (NioSocketWrapper) key.attach(null); if (ka!=null) handler.release(ka); else handler.release((SocketChannel)key.channel()); if (key.isValid()) key.cancel(); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org