Package org.apache.nifi.nar
Class AbstractNativeLibHandlingClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.apache.nifi.nar.AbstractNativeLibHandlingClassLoader
- All Implemented Interfaces:
Closeable
,AutoCloseable
,OSUtil
- Direct Known Subclasses:
NarClassLoader
An extension of
URLClassLoader
that can load native libraries from a
predefined list of directories as well as from those that are defined by
the java.library.path system property.
Once a library is found an OS-handled temporary copy is created and cached
to maintain consistency and classloader isolation.
This classloader handles the native library loading when the library is being loaded
by its logical name (System.loadLibrary(String)
/ Runtime.loadLibrary(String)
calls).
For loading a native library by its absolute path, see LoadNativeLibAspect
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.slf4j.Logger
Directories in which to look for native librariesUsed to cache (the paths of) temporary copies of loaded librariesprivate final String
Used as prefix when creating the temporary copies of libraries -
Constructor Summary
ConstructorsConstructorDescriptionAbstractNativeLibHandlingClassLoader
(URL[] urls, ClassLoader parent, List<File> initialNativeLibDirList, String tmpLibFilePrefix) AbstractNativeLibHandlingClassLoader
(URL[] urls, List<File> initialNativeLibDirList, String tmpLibFilePrefix) -
Method Summary
Modifier and TypeMethodDescriptionbuildNativeLibDirList
(List<File> initialNativeLibDirList) protected Path
createTempCopy
(String libname, String libraryOriginalPathString) findLibrary
(String libname) protected String
findLibrary
(String libname, File nativeLibDir) protected String
static File
Methods inherited from class java.net.URLClassLoader
addURL, close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.nifi.nar.OSUtil
isOsLinuxUnix, isOsMac, isOsWindows
-
Field Details
-
logger
private final org.slf4j.Logger logger -
nativeLibDirList
Directories in which to look for native libraries -
nativeLibNameToPath
Used to cache (the paths of) temporary copies of loaded libraries -
tmpLibFilePrefix
Used as prefix when creating the temporary copies of libraries
-
-
Constructor Details
-
AbstractNativeLibHandlingClassLoader
-
AbstractNativeLibHandlingClassLoader
public AbstractNativeLibHandlingClassLoader(URL[] urls, ClassLoader parent, List<File> initialNativeLibDirList, String tmpLibFilePrefix)
-
-
Method Details
-
toDir
-
findLibrary
- Overrides:
findLibrary
in classClassLoader
-
getUsrLibDirs
-
getJavaLibraryPath
-
createTempCopy
-
findLibrary
-
buildNativeLibDirList
-