Package io.netty.util.internal
Class NativeLibraryUtil
- java.lang.Object
-
- io.netty.util.internal.NativeLibraryUtil
-
final class NativeLibraryUtil extends java.lang.Object
A Utility to Call theSystem.load(String)
orSystem.loadLibrary(String)
. Because theSystem.load(String)
andSystem.loadLibrary(String)
are both CallerSensitive, it will load the native library into its caller'sClassLoader
. In OSGi environment, we need this helper to delegate the calling toSystem.load(String)
and it should be as simple as possible. It will be injected into the native library's ClassLoader when it is undefined. And therefore, when the defined new helper is invoked, the native library would be loaded into the native library's ClassLoader, not the caller's ClassLoader.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
NativeLibraryUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
loadLibrary(java.lang.String libName, boolean absolute)
Delegate the calling toSystem.load(String)
orSystem.loadLibrary(String)
.
-
-
-
Method Detail
-
loadLibrary
public static void loadLibrary(java.lang.String libName, boolean absolute)
Delegate the calling toSystem.load(String)
orSystem.loadLibrary(String)
.- Parameters:
libName
- - The native library path or nameabsolute
- - Whether the native library will be loaded by path or by name
-
-