(Auto)Closable components needs to be closed manually before JVM shutdown.
We cannot rely on GC here, cause this may cause resource leaks (or even security issues).
For jvpp components we used:
Runtime.getRuntime().addShutdownHook(new Thread()
(...)
public void run() {
jvpp.close();
}
We should at least provide some utility to decrease code repetition.
In order to minimize number of Threads needed, we could provide some component that would maintain list of closable components and take care of releasing resources.