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 2015/06/25 16:24:17 UTC

svn commit: r1687533 - in /tomcat/trunk/java/org/apache/coyote/http2: Http2UpgradeHandler.java LocalStrings.properties Stream.java

Author: markt
Date: Thu Jun 25 14:24:17 2015
New Revision: 1687533

URL: http://svn.apache.org/r1687533
Log:
Fix various TODOs

Modified:
    tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java
    tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties
    tomcat/trunk/java/org/apache/coyote/http2/Stream.java

Modified: tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java?rev=1687533&r1=1687532&r2=1687533&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java Thu Jun 25 14:24:17 2015
@@ -485,7 +485,7 @@ public class Http2UpgradeHandler extends
     }
 
 
-    int reserveWindowSize(Stream stream, int reservation) {
+    int reserveWindowSize(Stream stream, int reservation) throws IOException {
         // Need to be holding the stream lock so releaseBacklog() can't notify
         // this thread until after this thread enters wait()
         int allocation = 0;
@@ -521,8 +521,7 @@ public class Http2UpgradeHandler extends
                     try {
                         stream.wait();
                     } catch (InterruptedException e) {
-                        // TODO Auto-generated catch block
-                        e.printStackTrace();
+                        throw new IOException(e);
                     }
                 }
             } while (allocation == 0);

Modified: tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties?rev=1687533&r1=1687532&r2=1687533&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties Thu Jun 25 14:24:17 2015
@@ -61,6 +61,7 @@ http2Parser.processFrameWindowUpdate.inv
 http2Parser.processFrameWindowUpdate.invalidPayloadSize=Window update frame received with an invalid payload size of [{0}]
 http2Parser.swallow.debug=Connection [{0}], Stream [{1}], Swallowed [{2}] bytes
 
+stream.closed=Connection [{0}], Stream [{1}], Unable to write to stream once it has been closed
 stream.header.debug=Connection [{0}], Stream [{1}], HTTP header [{2}], Value [{3}]
 stream.reprioritisation.debug=Connection [{0}], Stream [{1}], Exclusive [{2}], Parent [{3}], Weight [{4}]
 stream.reset.debug=Connection [{0}], Stream [{1}], Reset due to [{2}]

Modified: tomcat/trunk/java/org/apache/coyote/http2/Stream.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Stream.java?rev=1687533&r1=1687532&r2=1687533&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/Stream.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/Stream.java Thu Jun 25 14:24:17 2015
@@ -132,13 +132,16 @@ public class Stream extends AbstractStre
     }
 
 
-    private synchronized int reserveWindowSize(int reservation) {
+    private synchronized int reserveWindowSize(int reservation) throws IOException {
         long windowSize = getWindowSize();
         while (windowSize < 1) {
             try {
                 wait();
             } catch (InterruptedException e) {
-                // TODO Auto-generated catch block
+                // Possible shutdown / rst or similar. Use an IOException to
+                // signal to the client that further I/O isn't possible for this
+                // Stream.
+                throw new IOException(e);
             }
             windowSize = getWindowSize();
         }
@@ -294,8 +297,8 @@ public class Stream extends AbstractStre
         @Override
         public synchronized int doWrite(ByteChunk chunk) throws IOException {
             if (closed) {
-                // TODO i18n
-                throw new IllegalStateException();
+                throw new IllegalStateException(
+                        sm.getString("stream.closed", getConnectionId(), getIdentifier()));
             }
             int len = chunk.getLength();
             int offset = 0;
@@ -409,7 +412,10 @@ public class Stream extends AbstractStre
                     try {
                         inBuffer.wait();
                     } catch (InterruptedException e) {
-                        // TODO: Possible shutdown?
+                        // Possible shutdown / rst or similar. Use an
+                        // IOException to signal to the client that further I/O
+                        // isn't possible for this Stream.
+                        throw new IOException(e);
                     }
                 }
 
@@ -422,7 +428,7 @@ public class Stream extends AbstractStre
                 } else if (!state.isFrameTypePermitted(FrameType.DATA)) {
                     return -1;
                 } else {
-                    // TODO Should never happen
+                    // Should never happen
                     throw new IllegalStateException();
                 }
             }



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