Author: remy.maucherat(a)jboss.com
Date: 2014-04-22 11:27:49 -0400 (Tue, 22 Apr 2014)
New Revision: 2405
Modified:
branches/7.4.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java
Log:
BZ1090103: NIO2 needs a sync to avoid event concurrency as there's no guarantee they
will go through the poller.
Modified: branches/7.4.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java
===================================================================
--- branches/7.4.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java 2014-04-22
14:48:04 UTC (rev 2404)
+++ branches/7.4.x/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java 2014-04-22
15:27:49 UTC (rev 2405)
@@ -927,8 +927,14 @@
@Override
public void run() {
try {
- Handler.SocketState state = ((status == null) ? handler.process(channel) : handler
- .event(channel, status));
+ Handler.SocketState state = null;
+ if (status == null) {
+ state = handler.process(channel);
+ } else {
+ synchronized (channel) {
+ state = handler.event(channel, status);
+ }
+ }
if (state == SocketState.CLOSED) {
closeChannel(channel);
Show replies by date