I've got a class which manages a cache of objects.
The cache is cleaned once an hour via ScheduledExecutorService
.
Is it ok to shutdown the ExecutorService
via the class finalize()
method?
@Override
protected void finalize() throws Throwable {
EXECUTOR_SERVICE.shutdownNow();
}
I'm currently running on Java 6.