You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/02/06 19:49:49 UTC
svn commit: r1443121 -
/tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java
Author: markt
Date: Wed Feb 6 18:49:49 2013
New Revision: 1443121
URL: http://svn.apache.org/viewvc?rev=1443121&view=rev
Log:
Move triggering of listener outside the sync block else users of the API (WebSocket in this case) can end up in deadlock through no fault of their own.
Modified:
tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java
Modified: tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java?rev=1443121&r1=1443120&r2=1443121&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/upgrade/AbstractServletOutputStream.java Wed Feb 6 18:49:49 2013
@@ -130,12 +130,18 @@ public abstract class AbstractServletOut
}
// Make sure canWrite() and onWritePossible() have a consistent view of
// buffer and fireListener when determining if the listener should fire
+ boolean fire = false;
+
synchronized (fireListenerLock) {
if (buffer == null && fireListener) {
fireListener = false;
- listener.onWritePossible();
+ fire = true;
}
}
+ if (fire) {
+ listener.onWritePossible();
+ }
+
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org