MySQL 5.6.14 Source Code Document
|
Classes | |
class | FilterClassLoader |
class | MyURLClassLoader |
class | SelfishFileClassLoader |
Static Public Member Functions | |
static void | test0 () throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, MalformedURLException, InstantiationException |
static void | test () throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, MalformedURLException, InstantiationException |
static void | main (String[] args) throws Exception |
Static Protected Attributes | |
static final PrintWriter | out = new PrintWriter(System.out, true) |
static final PrintWriter | err = new PrintWriter(System.err, true) |
static WeakReference< ClassLoader > | cl = null |
A test for loading, calling into, and unloading a native library.
Under the JNI specification, a native library is loaded by the class loader of that class which called the method System.loadLibrary(String). In a Java VM, a library cannot be loaded into more than one class loader (since JDK 1.2, to preserve the separation of name-spaces). A library is unloaded when the class loader containing the library is garbage collected.
Therefore, the task of loading of the native library has to be carried out by newly created class loader instances that are separate from the loader of this test class. This implies that this test class must not statically refer to the code calling into the native library, for this would load the native library by this class loader when running this test, and any subsequent attempt to load the library by another class loader instance would fail (with an UnsatisfiedLinkError).
Hence, this class tests the loading and unloading of a native library by executing the following cycle at least twice:
Definition at line 72 of file MyLoadUnloadTest.java.
|
staticprotected |
A weak reference to a class loader loading the native library.
Definition at line 103 of file MyLoadUnloadTest.java.
|
staticprotected |
The stream to write error messages to.
Definition at line 82 of file MyLoadUnloadTest.java.
|
staticprotected |
The stream to write messages to.
Definition at line 77 of file MyLoadUnloadTest.java.