On Mon, Oct 30, 2017 at 8:27 AM, Roger Riggs <Roger.Riggs@oracle.com> wrote:
Hi,
There is a test <repo>/test/jdk/java/util/conc urrent/Executors/AutoShutdown.java
It only tests it for Executors of newSingleThreadExecutor, not for the others so I wondered if there was some open issue.
I wrote that test long ago. But I've always been confused about automatic thread pool shutdown; it's not very reliable, especially given that all the threads need to terminate. Should TPE's finalization spec apply to STPE? TPE is a brittle class; we avoid doing too much surgery on it (even though we're in the middle of doing exactly that to fix an actual bug).
The initiative is to identify and remediate existing uses of finalization in the JDK.
I've been skeptical about this initiative as stated. I would not have deprecated finalize(). We will never remove finalize() from the JDK, and I don't see how switching TPE from finalize to some other mechanism such as Cleaner has real benefits for users. There aren't enough instances of TPE created for finalization to be a real user performance problem. TPE's spec currently has a finalize deprecation warning, but this is not helpful for users. (a documentation readability regression!) https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/ThreadPoolExe...