Author: remm
Date: Thu Mar 13 23:27:12 2014
New Revision: 1577376

URL: http://svn.apache.org/r1577376
Log:
With the writeLock in use in the superclass, remove the useless extra locking 
(after testing).

Modified:
    
tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletOutputStream.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletOutputStream.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletOutputStream.java?rev=1577376&r1=1577375&r2=1577376&view=diff
==============================================================================
--- 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletOutputStream.java 
(original)
+++ 
tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletOutputStream.java 
Thu Mar 13 23:27:12 2014
@@ -49,13 +49,11 @@ public class Nio2ServletOutputStream ext
         this.completionHandler = new CompletionHandler<Integer, 
SocketWrapper<Nio2Channel>>() {
             @Override
             public void completed(Integer nBytes, SocketWrapper<Nio2Channel> 
attachment) {
-                synchronized (completionHandler) {
-                    if (nBytes.intValue() < 0) {
-                        failed(new ClosedChannelException(), attachment);
-                        return;
-                    }
-                    writePending.release();
+                if (nBytes.intValue() < 0) {
+                    failed(new ClosedChannelException(), attachment);
+                    return;
                 }
+                writePending.release();
                 if (!Nio2Endpoint.isInline()) {
                     try {
                         onWritePossible();
@@ -135,15 +133,13 @@ public class Nio2ServletOutputStream ext
             }
         } else {
             if (writePending.tryAcquire()) {
-                synchronized (completionHandler) {
-                    buffer.clear();
-                    buffer.put(b, off, len);
-                    buffer.flip();
-                    Nio2Endpoint.startInline();
-                    channel.write(buffer, socketWrapper.getTimeout(), 
TimeUnit.MILLISECONDS, socketWrapper, completionHandler);
-                    Nio2Endpoint.endInline();
-                    written = len;
-                }
+                buffer.clear();
+                buffer.put(b, off, len);
+                buffer.flip();
+                Nio2Endpoint.startInline();
+                channel.write(buffer, socketWrapper.getTimeout(), 
TimeUnit.MILLISECONDS, socketWrapper, completionHandler);
+                Nio2Endpoint.endInline();
+                written = len;
             }
         }
         return written;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to