geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sai_boorlaga...@apache.org
Subject incubator-geode git commit: initial commit
Date Mon, 20 Jun 2016 23:19:33 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-1573 [created] a257982de


initial commit


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/a257982d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/a257982d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/a257982d

Branch: refs/heads/feature/GEODE-1573
Commit: a257982deecc3e6ed944ac0b3a5f84e2f39b5011
Parents: 832ddd1
Author: Sai Boorlagadda <sboorlagadda@pivotal.io>
Authored: Mon Jun 20 13:43:30 2016 -0700
Committer: Sai Boorlagadda <sboorlagadda@pivotal.io>
Committed: Mon Jun 20 13:43:30 2016 -0700

----------------------------------------------------------------------
 geode-core/build.gradle                         |  4 +--
 .../gemfire/compression/SnappyCompressor.java   | 28 ++++--------------
 .../compression/SnappyCompressorJUnitTest.java  | 30 --------------------
 gradle/dependency-versions.properties           |  3 +-
 4 files changed, 9 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a257982d/geode-core/build.gradle
----------------------------------------------------------------------
diff --git a/geode-core/build.gradle b/geode-core/build.gradle
index af5c02b..030885e 100755
--- a/geode-core/build.gradle
+++ b/geode-core/build.gradle
@@ -96,9 +96,9 @@ dependencies {
     exclude module: 'spring-context-support'
     ext.optional = true
   }
-  compile ('org.xerial.snappy:snappy-java:' + project.'snappy-java.version') {
+  compile ('org.iq80.snappy:snappy:' + project.'snappy-java.version') {
     ext.optional = true
-  }
+  } 
 
   compile 'org.apache.shiro:shiro-core:' + project.'shiro.version'
  

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a257982d/geode-core/src/main/java/com/gemstone/gemfire/compression/SnappyCompressor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/compression/SnappyCompressor.java
b/geode-core/src/main/java/com/gemstone/gemfire/compression/SnappyCompressor.java
index 512756a..af345d6 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/compression/SnappyCompressor.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/compression/SnappyCompressor.java
@@ -17,12 +17,12 @@
 
 package com.gemstone.gemfire.compression;
 
-import java.io.IOException;
 import java.io.Serializable;
 import java.util.concurrent.atomic.AtomicReference;
 
-import org.xerial.snappy.Snappy;
-import org.xerial.snappy.SnappyError;
+
+import org.iq80.snappy.CorruptionException;
+import org.iq80.snappy.Snappy;
 
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 
@@ -39,25 +39,11 @@ public final class SnappyCompressor implements Compressor, Serializable
{
   // instance in the VM.
   private static final AtomicReference<SnappyCompressor> defaultInstance = new AtomicReference<SnappyCompressor>();
   
-  // Set to true when we've loaded the Snappy native library.
-  private static boolean nativeLibraryLoaded = false;
-  
   /**
    * Create a new instance of the SnappyCompressor.
    * @throws IllegalStateException when the Snappy native library is unavailable
    */
   public SnappyCompressor() {
-    synchronized (defaultInstance) {
-      if (!nativeLibraryLoaded) {
-        try {
-          String s = Snappy.getNativeLibraryVersion();
-          System.out.println(s);
-        } catch (SnappyError se) {
-          throw new IllegalStateException(LocalizedStrings.SnappyCompressor_UNABLE_TO_LOAD_NATIVE_SNAPPY_LIBRARY.toLocalizedString(),
se);
-        }
-        nativeLibraryLoaded = true;
-      }
-    }
   }
   
   /**
@@ -75,18 +61,14 @@ public final class SnappyCompressor implements Compressor, Serializable
{
 
   @Override
   public byte[] compress(byte[] input) {
-    try {
       return Snappy.compress(input);
-    } catch (IOException e) {
-      throw new CompressionException(e);
-    }
   }
 
   @Override
   public byte[] decompress(byte[] input) {
     try {
-      return Snappy.uncompress(input);
-    } catch (IOException e) {
+      return Snappy.uncompress(input, 0, input.length);
+    } catch (CorruptionException e) {
       throw new CompressionException(e);
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a257982d/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/SnappyCompressorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/SnappyCompressorJUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/SnappyCompressorJUnitTest.java
index ae8bf7b..d1b0fea 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/SnappyCompressorJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/SnappyCompressorJUnitTest.java
@@ -18,13 +18,8 @@ package com.gemstone.gemfire.internal.compression;
 
 import static org.junit.Assert.*;
 
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
-import org.xerial.snappy.SnappyLoader;
 
 import com.gemstone.gemfire.compression.Compressor;
 import com.gemstone.gemfire.compression.SnappyCompressor;
@@ -47,29 +42,4 @@ public class SnappyCompressorJUnitTest {
 
     assertEquals(compressMe, uncompressedMe);
   }
-  
-  /**
-   * Tests {@link SnappyCompressor#SnappyCompressor()} constructor.
-   */
-  @Test
-  public void testConstructor() throws Exception {
-    SnappyCompressor.getDefaultInstance();
-
-    // repeat findNativeLibrary and make sure it's pointing at a file in tmpdir
-    Method findNativeLibraryMethod = SnappyLoader.class.getDeclaredMethod("findNativeLibrary",
new Class[0]);
-    findNativeLibraryMethod.setAccessible(true);
-    File nativeLibrary = (File) findNativeLibraryMethod.invoke(null);
-
-    System.out.println(nativeLibrary);
-
-    assertNotNull(nativeLibrary);
-    assertTrue(nativeLibrary + " does not exist", nativeLibrary.exists());
-
-    File tmpDir = new File(System.getProperty("java.io.tmpdir"));
-    assertTrue(tmpDir.exists());
-
-    File parent = nativeLibrary.getParentFile();
-    assertNotNull(parent);
-    assertEquals(tmpDir, parent);
-  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/a257982d/gradle/dependency-versions.properties
----------------------------------------------------------------------
diff --git a/gradle/dependency-versions.properties b/gradle/dependency-versions.properties
index 9de665c..ad9275f 100644
--- a/gradle/dependency-versions.properties
+++ b/gradle/dependency-versions.properties
@@ -90,7 +90,8 @@ scala.version = 2.10.0
 selenium.version=2.53.0
 shiro.version=1.2.4
 slf4j-api.version = 1.7.7
-snappy-java.version = 1.1.1.6
+#snappy-java.version = 1.1.1.6
+snappy-java.version=0.4
 spring-hateos.version = 0.16.0.RELEASE
 spring-shell.version = 1.1.0.RELEASE
 spring-ldap-core.version = 1.3.2.RELEASE


Mime
View raw message