You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2018/12/07 21:14:15 UTC

[pulsar] branch master updated: fix CompressionCodecLZ4 (#3141)

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/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 77e5809  fix CompressionCodecLZ4 (#3141)
77e5809 is described below

commit 77e58096af7dfee59a6853b926eef05555a30851
Author: Boyang Jerry Peng <je...@gmail.com>
AuthorDate: Fri Dec 7 13:14:10 2018 -0800

    fix CompressionCodecLZ4 (#3141)
---
 .../apache/pulsar/common/compression/CompressionCodecLZ4.java  | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/pulsar-common/src/main/java/org/apache/pulsar/common/compression/CompressionCodecLZ4.java b/pulsar-common/src/main/java/org/apache/pulsar/common/compression/CompressionCodecLZ4.java
index 01b600d..a57992c 100644
--- a/pulsar-common/src/main/java/org/apache/pulsar/common/compression/CompressionCodecLZ4.java
+++ b/pulsar-common/src/main/java/org/apache/pulsar/common/compression/CompressionCodecLZ4.java
@@ -23,6 +23,7 @@ import java.nio.ByteBuffer;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.PooledByteBufAllocator;
+import lombok.extern.slf4j.Slf4j;
 import net.jpountz.lz4.LZ4Compressor;
 import net.jpountz.lz4.LZ4Factory;
 import net.jpountz.lz4.LZ4FastDecompressor;
@@ -30,11 +31,16 @@ import net.jpountz.lz4.LZ4FastDecompressor;
 /**
  * LZ4 Compression
  */
+@Slf4j
 public class CompressionCodecLZ4 implements CompressionCodec {
 
     static {
-        // Force the attempt to load LZ4 JNI
-        net.jpountz.util.Native.load();
+        try {
+            // Force the attempt to load LZ4 JNI
+            net.jpountz.util.Native.load();
+        } catch (Throwable th) {
+            log.warn("Failed to load native LZ4 implementation: {}", th.getMessage());
+        }
     }
 
     private static final LZ4Factory lz4Factory = LZ4Factory.fastestInstance();