Author: remm
Date: Fri Mar 21 11:07:20 2014
New Revision: 1579925

URL: http://svn.apache.org/r1579925
Log:
- Reliably allow blocking following non blocking if some flushing is needed on 
end.
- Use debug log level in case of a rejected execution, which can occur on 
shutdown.

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
    tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java?rev=1579925&r1=1579924&r2=1579925&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNio2OutputBuffer.java 
Fri Mar 21 11:07:20 2014
@@ -381,7 +381,15 @@ public class InternalNio2OutputBuffer ex
                         byteBuffer.flip();
                         flipped = true;
                     }
-                    
socket.getSocket().write(byteBuffer).get(socket.getTimeout(), 
TimeUnit.MILLISECONDS);
+                    if (bufferedWrites.size() > 0) {
+                        for (ByteBuffer buffer : bufferedWrites) {
+                            buffer.flip();
+                            
socket.getSocket().write(buffer).get(socket.getTimeout(), 
TimeUnit.MILLISECONDS);
+                        }
+                    }
+                    if (byteBuffer.hasRemaining()) {
+                        
socket.getSocket().write(byteBuffer).get(socket.getTimeout(), 
TimeUnit.MILLISECONDS);
+                    }
                 } catch (InterruptedException | ExecutionException e) {
                     throw new IOException(e);
                 } catch (TimeoutException e) {

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1579925&r1=1579924&r2=1579925&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Fri Mar 21 
11:07:20 2014
@@ -563,7 +563,7 @@ public class Nio2Endpoint extends Abstra
                 sc.run();
             }
         } catch (RejectedExecutionException ree) {
-            log.warn(sm.getString("endpoint.executor.fail", socket), ree);
+            log.debug(sm.getString("endpoint.executor.fail", socket), ree);
             return false;
         } catch (Throwable t) {
             ExceptionUtils.handleThrowable(t);



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

Reply via email to