In General
I want to be able to close my Java application even if there are (non-daemon) threads still running. Is it possible in Java? (Coming from C++ world, that seems like a basic request)
Reason
I'm building a framework that load external plugins that implement an interface. before shutting down I call a close()
function on each plugin expect it to release all it resource and stop all his threads. But since the plugin are build by several teams at my workplace I can't really control them and more than once someone didn't close all his threads leaving the application stuck in the shutdown stage.
I would like to close the program forcefully after I called each plugin close()
function, If they didn't take care of their resources it's their own problem...
to exit the program try
System.exit(0);
and try
finalize();
if you want to release the resoureces