I'm using some external, i.e. jar, library in my application which unfortunately does not properly clean up after itself, i.e. the second time I create an object from this library it does not work as expected. I suspect that it is because the library creates some threads which keep running, but I'm not sure.
Is there any way to force a complete clean up of the mess that external library creates?
There might be reasons unrelated to threads. For example, static class initializers only run once, when the class is loaded for the first time. So something like this may be the cause:
public class StupidSingleton {
private static StupidSingleton instance;
public StupidSingleton() {
if (instance == null) {
instance = this;
} else {
instance.foo(); // the implementation is irrelevant in this context
}
}
}
Whatever it is, there are three basic solutions available:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With