This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new ede2108  Release resources for ZLib inflater/deflater when not used 
(#2111)
ede2108 is described below

commit ede2108d1a7a2f73288a768c5c673c0b53b820a0
Author: Matteo Merli <mme...@apache.org>
AuthorDate: Thu Jul 12 12:23:55 2018 -0700

    Release resources for ZLib inflater/deflater when not used (#2111)
---
 .../apache/pulsar/common/compression/CompressionCodecZLib.java | 10 ++++++++++
 1 file changed, 10 insertions(+)

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 169e347..5137dc1 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 @@ public class CompressionCodecZLib implements 
CompressionCodec {
         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 @@ public class CompressionCodecZLib implements 
CompressionCodec {
         protected Inflater initialValue() throws Exception {
             return new Inflater();
         }
+
+        @Override
+        protected void onRemoval(Inflater inflater) throws Exception {
+            inflater.end();
+        }
     };
 
     @Override

Reply via email to