[tomcat] 01/02: Add the plumbing to 'recycle' an HTTP/2 Stream
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit d88e0840c0278ed72fb14d9bf65b67097fe5a0bb Author: Mark Thomas AuthorDate: Thu Jun 25 11:57:58 2020 +0100 Add the plumbing to 'recycle' an HTTP/2 Stream --- java/org/apache/coyote/http2/Stream.java | 13 + java/org/apache/coyote/http2/StreamProcessor.java | 3 +++ 2 files changed, 16 insertions(+) diff --git a/java/org/apache/coyote/http2/Stream.java b/java/org/apache/coyote/http2/Stream.java index 32de3fe..5f28617 100644 --- a/java/org/apache/coyote/http2/Stream.java +++ b/java/org/apache/coyote/http2/Stream.java @@ -681,6 +681,19 @@ public class Stream extends AbstractStream implements HeaderEmitter { if (inputBuffer != null) { inputBuffer.receiveReset(); } +recycle(); +} + + +/* + * This method is called recycle for consistency with the rest of the Tomcat + * code base. Currently, it only sets references to null for the purposes of + * reducing memory footprint. It does not fully recycle the Stream ready for + * re-use since Stream objects are not re-used. + */ +final void recycle() { +// Currently a NO-OP. This will change shortly to address the TODO for +// nulling out references. } diff --git a/java/org/apache/coyote/http2/StreamProcessor.java b/java/org/apache/coyote/http2/StreamProcessor.java index 0106cf4..5a24f44 100644 --- a/java/org/apache/coyote/http2/StreamProcessor.java +++ b/java/org/apache/coyote/http2/StreamProcessor.java @@ -86,6 +86,9 @@ class StreamProcessor extends AbstractProcessor { stream.getIdAsInt()); } stream.close(se); +} else { +// stream.close() will call recycle so only need it here +stream.recycle(); } } } catch (Exception e) { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/02: Add the plumbing to 'recycle' an HTTP/2 Stream
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 61980cdfdcdada9cd023d30ab5af35010b1e084b Author: Mark Thomas AuthorDate: Thu Jun 25 11:57:58 2020 +0100 Add the plumbing to 'recycle' an HTTP/2 Stream --- java/org/apache/coyote/http2/Stream.java | 13 + java/org/apache/coyote/http2/StreamProcessor.java | 3 +++ 2 files changed, 16 insertions(+) diff --git a/java/org/apache/coyote/http2/Stream.java b/java/org/apache/coyote/http2/Stream.java index 65d636d..878fd2f 100644 --- a/java/org/apache/coyote/http2/Stream.java +++ b/java/org/apache/coyote/http2/Stream.java @@ -725,6 +725,19 @@ class Stream extends AbstractStream implements HeaderEmitter { } else { handler.closeConnection(http2Exception); } +recycle(); +} + + +/* + * This method is called recycle for consistency with the rest of the Tomcat + * code base. Currently, it only sets references to null for the purposes of + * reducing memory footprint. It does not fully recycle the Stream ready for + * re-use since Stream objects are not re-used. + */ +final void recycle() { +// Currently a NO-OP. This will change shortly to address the TODO for +// nulling out references. } diff --git a/java/org/apache/coyote/http2/StreamProcessor.java b/java/org/apache/coyote/http2/StreamProcessor.java index 80c22ec..2b41753 100644 --- a/java/org/apache/coyote/http2/StreamProcessor.java +++ b/java/org/apache/coyote/http2/StreamProcessor.java @@ -89,6 +89,9 @@ class StreamProcessor extends AbstractProcessor { stream.getIdAsInt()); } stream.close(se); +} else { +// stream.close() will call recycle so only need it here +stream.recycle(); } } } catch (Exception e) { - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org