How can we unload a our custom classloader? This is the code that i have written to use my own classloader to load classes.
Myloader ccl = new Myloader(); // Load the main class through our class loader Class clas = ccl.loadClass( "mymainclass" );
Class mainArgType[] = { (new String[0]).getClass() }; // Find the standard main method in the class Method main = clas.getMethod( "main", mainArgType ); Object argsArray[] = { progArgs }; // Call the main method main.invoke( null, argsArray );
-> Inside the main iam just creating a thread and coming out.
-> Newly created thread waits for a connection from a client socket.
How can i unload the classloader so that i can unload all the classes loaded by my custom classloader.
If i unload my classloader what will happen to all the threads? If they continue to run, which class loader will it use to load the classes?