Author: remy.maucherat(a)jboss.com
Date: 2014-02-25 12:12:41 -0500 (Tue, 25 Feb 2014)
New Revision: 2370
Modified:
branches/7.4.x/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java
branches/7.4.x/src/main/java/org/apache/coyote/http11/Http11NioProtocol.java
Log:
Add some sync to avoid missing some event processing (hopefully).
Modified: branches/7.4.x/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java
===================================================================
---
branches/7.4.x/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java 2014-02-20
18:29:05 UTC (rev 2369)
+++
branches/7.4.x/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java 2014-02-25
17:12:41 UTC (rev 2370)
@@ -733,7 +733,7 @@
* @param param
* the vent parameter
*/
- private void resumeEvent(Object param, boolean read) {
+ private synchronized void resumeEvent(Object param, boolean read) {
if (read) {
readNotifications = true;
}
@@ -751,7 +751,7 @@
*
* @param param
*/
- private void writeEvent(Object param) {
+ private synchronized void writeEvent(Object param) {
// An event is being processed already: adding for write will be
// done
// when the channel gets back to the poller
Modified: branches/7.4.x/src/main/java/org/apache/coyote/http11/Http11NioProtocol.java
===================================================================
---
branches/7.4.x/src/main/java/org/apache/coyote/http11/Http11NioProtocol.java 2014-02-20
18:29:05 UTC (rev 2369)
+++
branches/7.4.x/src/main/java/org/apache/coyote/http11/Http11NioProtocol.java 2014-02-25
17:12:41 UTC (rev 2370)
@@ -807,7 +807,7 @@
*/
@Override
// FIXME: probably needs sync due to concurrent read/write possibilities
- public synchronized SocketState event(NioChannel channel, SocketStatus status) {
+ public SocketState event(NioChannel channel, SocketStatus status) {
Http11NioProcessor processor = connections.get(channel.getId());
SocketState state = SocketState.CLOSED;
@@ -864,18 +864,22 @@
// NOPE
}
}
+ processor.endProcessing();
} else {
if (processor.isAvailable() && processor.getReadNotifications()) {
// Call a read event right away
state = event(channel, SocketStatus.OPEN_READ);
+ processor.endProcessing();
} else if (proto.endpoint.isRunning()) {
- proto.endpoint.addEventChannel(channel, processor.getTimeout(),
- false,
- processor.getWriteNotification(),
- processor.getResumeNotification(), false);
+ synchronized (processor) {
+ proto.endpoint.addEventChannel(channel, processor.getTimeout(),
+ false,
+ processor.getWriteNotification(),
+ processor.getResumeNotification(), false);
+ processor.endProcessing();
+ }
}
}
- processor.endProcessing();
}
}
@@ -915,15 +919,19 @@
if (processor.isAvailable() && processor.getReadNotifications()) {
// Call a read event right away
state = event(channel, SocketStatus.OPEN_READ);
+ processor.endProcessing();
} else {
- proto.endpoint.addEventChannel(channel, processor.getTimeout(),
- processor.getReadNotifications(), false,
- processor.getResumeNotification(), false);
+ synchronized (processor) {
+ proto.endpoint.addEventChannel(channel, processor.getTimeout(),
+ processor.getReadNotifications(), false,
+ processor.getResumeNotification(), false);
+ processor.endProcessing();
+ }
}
} else {
recycledProcessors.offer(processor);
+ processor.endProcessing();
}
- processor.endProcessing();
return state;
} catch (IOException e) {
Show replies by date