Hi Alan,

Ah, I hadn’t realized that there’s already some tight coupling between
Thread and nio. OK, I’ll just call into sun.nio directly and see what the
reviewers say. :-) Is there a CR for this already? Or should I create one?

Tony


—————
Tony Printezis | @TonyPrintezis | tprinte...@twitter.com


On April 6, 2018 at 12:45:29 PM, Alan Bateman (alan.bate...@oracle.com)
wrote:

On 06/04/2018 15:08, Tony Printezis wrote:

Hi Alan,

Calling sun.nio directly from java.lang seemed a bit dodgy to me, which is
why I proposed some type of exit hook (maybe I overthought this?). But
that’d be OK, could make this change a lot simpler. :-) And, yes, I came
across the issue of not being able to query whether a ThreadLocal exists on
a Thread when I implemented my prototype. Which is why I think introducing
an exit hook on ThreadLocal, instead of Thread, is probably the better
approach (it will only be called if the ThreadLocal exists).

java.lang.Thread is already tightly connected to blocking I/O operations
(Thread::interrupt for example). In any case, the concern with exposing
exit hooks in the API is that it means running arbitrary code when exiting,
something that would need a lot of consideration before going there.

-Alan

Reply via email to