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 <ma...@apache.org>
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

Reply via email to