#84: 1.0.5.3 release. Append UUID to the extracted lib file name

This commit is contained in:
Taro L. Saito 2014-08-17 12:15:49 +09:00
parent 4e91ac909e
commit 89277ddb7a
2 changed files with 6 additions and 7 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.xerial.snappy</groupId> <groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId> <artifactId>snappy-java</artifactId>
<version>1.0.5.2</version> <version>1.0.5.3</version>
<name>Snappy for Java</name> <name>Snappy for Java</name>
<description>snappy-java: A fast compression/decompression library</description> <description>snappy-java: A fast compression/decompression library</description>
<packaging>bundle</packaging> <packaging>bundle</packaging>

View File

@ -38,10 +38,7 @@ import java.security.DigestInputStream;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.security.ProtectionDomain; import java.security.ProtectionDomain;
import java.util.ArrayList; import java.util.*;
import java.util.Enumeration;
import java.util.List;
import java.util.Properties;
/** /**
* <b>Internal only - Do not use this class.</b> This class loads a native * <b>Internal only - Do not use this class.</b> This class loads a native
@ -366,8 +363,10 @@ public class SnappyLoader
*/ */
private static File extractLibraryFile(String libFolderForCurrentOS, String libraryFileName, String targetFolder) { private static File extractLibraryFile(String libFolderForCurrentOS, String libraryFileName, String targetFolder) {
String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName; String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName;
final String prefix = "snappy-" + getVersion() + "-";
String extractedLibFileName = prefix + libraryFileName; // Attach UUID to the native library file to ensure multiple class loaders can read the libsnappy-java multiple times.
String uuid = UUID.randomUUID().toString();
String extractedLibFileName = String.format("snappy-%s-%s-%s", getVersion(), uuid, libraryFileName);
File extractedLibFile = new File(targetFolder, extractedLibFileName); File extractedLibFile = new File(targetFolder, extractedLibFileName);
try { try {