[jboss-cvs] JBossAS SVN: r99749 - in projects/jboss-cl/trunk: classloading/src/main/java/org/jboss/classloading/spi/metadata and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 21 09:06:10 EST 2010
Author: adrian at jboss.org
Date: 2010-01-21 09:06:10 -0500 (Thu, 21 Jan 2010)
New Revision: 99749
Added:
projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/NativeLibraryProvider.java
Modified:
projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/ClassLoaderPolicy.java
projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/ClassLoadingMetaData.java
projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/NativeLibrary.java
Log:
Move public interface to top level, thread safety and source code tidyup
Modified: projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/ClassLoaderPolicy.java
===================================================================
--- projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/ClassLoaderPolicy.java 2010-01-21 13:37:05 UTC (rev 99748)
+++ projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/ClassLoaderPolicy.java 2010-01-21 14:06:10 UTC (rev 99749)
@@ -67,31 +67,21 @@
private List<ClassFoundHandler> classFoundHandlers;
/** Maps native library to its provider */
- private Map<String, NativeLibraryProvider> libraryMap;
+ private volatile Map<String, NativeLibraryProvider> libraryMap;
/**
- * Provides the actual local file location for a native library
- */
- public interface NativeLibraryProvider
- {
- /** Get the library path */
- String getLibraryPath();
-
- /** Get the local library file location. This may be proved lazily. */
- File getLibraryLocation() throws IOException;
- }
-
- /**
* Get the set of registered native library names.
*
* @return Null if there are no native libraries registered.
*/
public Set<String> getNativeLibraryNames()
{
- if (libraryMap == null)
+ Map<String, NativeLibraryProvider> map = libraryMap;
+
+ if (map == null)
return Collections.emptySet();
- return libraryMap.keySet();
+ return Collections.unmodifiableSet(libraryMap.keySet());
}
/**
@@ -102,7 +92,9 @@
*/
public NativeLibraryProvider getNativeLibrary(String libname)
{
- return (libraryMap != null ? libraryMap.get(libname) : null);
+ Map<String, NativeLibraryProvider> map = libraryMap;
+
+ return (map != null ? map.get(libname) : null);
}
/**
@@ -132,20 +124,20 @@
/**
* Returns the absolute path name of a native library.
*
- * @see ClassLoader.findLibrary(String libname)
* @param libname The library name
* @return The absolute path of the native library, or null
*/
public String findLibrary(String libname)
{
- if (libraryMap == null)
+ Map<String, NativeLibraryProvider> map = libraryMap;
+ if (map == null)
return null;
- NativeLibraryProvider libProvider = libraryMap.get(libname);
+ NativeLibraryProvider libProvider = map.get(libname);
// [TODO] why does the TCK use 'Native' to mean 'libNative' ?
if (libProvider == null)
- libProvider = libraryMap.get("lib" + libname);
+ libProvider = map.get("lib" + libname);
if (libProvider == null)
return null;
Added: projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/NativeLibraryProvider.java
===================================================================
--- projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/NativeLibraryProvider.java (rev 0)
+++ projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/NativeLibraryProvider.java 2010-01-21 14:06:10 UTC (rev 99749)
@@ -0,0 +1,50 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2010, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.classloader.spi;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * NativeLibraryProvider.
+ *
+ * @author thomas.diesler at jboss.com
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface NativeLibraryProvider
+{
+ /**
+ * Get the library path
+ *
+ * @return the library path
+ */
+ String getLibraryPath();
+
+ /**
+ * Get the local library file location. This may be proved lazily.
+ *
+ * @return the file
+ * @throws IOException for any error
+ */
+ File getLibraryLocation() throws IOException;
+}
Modified: projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/ClassLoadingMetaData.java
===================================================================
--- projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/ClassLoadingMetaData.java 2010-01-21 13:37:05 UTC (rev 99748)
+++ projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/ClassLoadingMetaData.java 2010-01-21 14:06:10 UTC (rev 99749)
@@ -527,7 +527,7 @@
/**
* Set the native libraries.
*
- * @param native libraries the native libraries.
+ * @param nativeLibraries libraries the native libraries.
* @throws IllegalArgumentException for null native libraries
*/
public void setNativeLibraries(NativeLibraryMetaData nativeLibraries)
Modified: projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/NativeLibrary.java
===================================================================
--- projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/NativeLibrary.java 2010-01-21 13:37:05 UTC (rev 99748)
+++ projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/NativeLibrary.java 2010-01-21 14:06:10 UTC (rev 99749)
@@ -58,7 +58,7 @@
* Create a NativeCode instance with mandatory properties.
* @param osNames The set of OS names
* @param libraryPath The library path
- * @param fileProvider An interface from which to retrieve the actual library location
+ * @param librarySource An interface from which to retrieve the actual library location
*/
public NativeLibrary(List<String> osNames, String libraryPath, String librarySource)
{
More information about the jboss-cvs-commits
mailing list