You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/07/12 19:23:57 UTC

[GitHub] merlimat closed pull request #2111: Release resources for ZLib inflater/deflater when not used

merlimat closed pull request #2111: Release resources for ZLib inflater/deflater when not used
URL: https://github.com/apache/incubator-pulsar/pull/2111
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pulsar-common/src/main/java/org/apache/pulsar/common/compression/CompressionCodecZLib.java b/pulsar-common/src/main/java/org/apache/pulsar/common/compression/CompressionCodecZLib.java
index 169e34706d..5137dc1e0e 100644
--- a/pulsar-common/src/main/java/org/apache/pulsar/common/compression/CompressionCodecZLib.java
+++ b/pulsar-common/src/main/java/org/apache/pulsar/common/compression/CompressionCodecZLib.java
@@ -39,6 +39,11 @@
         protected Deflater initialValue() throws Exception {
             return new Deflater();
         }
+
+        @Override
+        protected void onRemoval(Deflater deflater) throws Exception {
+            deflater.end();
+        }
     };
 
     private final FastThreadLocal<Inflater> inflater = new FastThreadLocal<Inflater>() {
@@ -46,6 +51,11 @@ protected Deflater initialValue() throws Exception {
         protected Inflater initialValue() throws Exception {
             return new Inflater();
         }
+
+        @Override
+        protected void onRemoval(Inflater inflater) throws Exception {
+            inflater.end();
+        }
     };
 
     @Override


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services