tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Recycling processors in Http11NioProtocol
Date Thu, 14 Oct 2010 00:01:55 GMT
Hi!

Looking at the Http11NioProtocol.Http11ConnectionHandler.release(NioChannel
socket) method in Http11NioProtocol.java,  it looks for me that like
that method does in all other places before any call to
"recycledProcessors.offer(result);" there should be
 - a call to connections.remove(socket)
 - a call to Http11NioProcessor.recycle()

I see two places where those calls are missing.  A patch is inline
below,  as well as attached to the message. Any comments? I might miss
something.

I cannot call release(socket) in the second case, as it is possible
that connections.remove(socket) call will return null there.

[[[
Index: java/org/apache/coyote/http11/Http11NioProtocol.java
===================================================================
--- java/org/apache/coyote/http11/Http11NioProtocol.java	(revision 1022323)
+++ java/org/apache/coyote/http11/Http11NioProtocol.java	(working copy)
@@ -330,8 +330,7 @@
                         state = processor.asyncPostProcess();
                     }
                     if (state != SocketState.LONG && state !=
SocketState.ASYNC_END) {
-                        connections.remove(socket);
-                        recycledProcessors.offer(processor);
+                        release(socket);
                         if (state == SocketState.OPEN) {
                             socket.getPoller().add(socket);
                         }
@@ -422,6 +421,8 @@
                 // less-than-verbose logs.
                 log.error(sm.getString("http11protocol.proto.error"), e);
             }
+            connections.remove(socket);
+            processor.recycle();
             recycledProcessors.offer(processor);
             return SocketState.CLOSED;
         }

]]]

Best regards,
Konstantin Kolinko

Mime
View raw message