Author: markt Date: Mon Nov 2 14:30:40 2015 New Revision: 1712012 URL: http://svn.apache.org/viewvc?rev=1712012&view=rev Log: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58058 Fix thread safety. Align with 9.0.x
Modified: tomcat/tc8.0.x/trunk/java/org/apache/tomcat/jni/Library.java Modified: tomcat/tc8.0.x/trunk/java/org/apache/tomcat/jni/Library.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/tomcat/jni/Library.java?rev=1712012&r1=1712011&r2=1712012&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/java/org/apache/tomcat/jni/Library.java (original) +++ tomcat/tc8.0.x/trunk/java/org/apache/tomcat/jni/Library.java Mon Nov 2 14:30:40 2015 @@ -32,7 +32,7 @@ public final class Library { */ private static Library _instance = null; - private Library() throws Throwable { + private Library() throws Exception { boolean loaded = false; String path = System.getProperty("java.library.path"); String [] paths = path.split(File.pathSeparator); @@ -45,7 +45,7 @@ public final class Library { throw t; } catch (VirtualMachineError t) { // Don't use a Java 7 multiple exception catch so we can keep - // the JNI code identical between Tomcat 6/7/8 + // the JNI code identical between Tomcat 6/7/8/9 throw t; } catch (Throwable t) { String name = System.mapLibraryName(NAMES[i]); @@ -166,10 +166,13 @@ public final class Library { * Setup any APR internal data structures. This MUST be the first function * called for any APR library. * @param libraryName the name of the library to load + * + * @return {@code true} if the native code was initialized successfully + * otherwise {@code false} + * + * @throws Exception if a problem occurred during initialization */ - public static boolean initialize(String libraryName) - throws Throwable - { + public synchronized static boolean initialize(String libraryName) throws Exception { if (_instance == null) { if (libraryName == null) _instance = new Library(); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org