My problem is straightforward. I have a class that has a static ThreadPoolExecutor
object. This threadpoolexecutor object is thus shared by all the instances of the class. If i were to shut the entire application down the shared class object would be garbage collected. I would like the threadpoolexecutor to be able to finish its pending jobs by calling shutdown
on it and awaitTermination
after that. This should be done in the finalize()
method of the class object itself. My question is: How do i override the finalize()
method of the class object itself? Is this even possible?
Thank you