py4j icon indicating copy to clipboard operation
py4j copied to clipboard

Give py4j threads explicit names, mark them as daemon

Open alexarchambault opened this issue 3 years ago • 2 comments

This PR makes py4j give more explicit names to the threads it creates (like py4j-… rather than the default Thread-…), which makes it easier to inspect JVM processes where py4j is running.

It also marks those threads as daemon, so that exiting the main thread of the JVM, by reaching the end of the main method, actually makes the JVM exit (provided no other non-daemon threads were created by users).

alexarchambault avatar Aug 24 '22 15:08 alexarchambault

I didn't go as far as allowing py4j users to provide their own ThreadFactory, but I guess that would be the next step. That would allow users to more finely manage py4j threads if they need to.

alexarchambault avatar Aug 24 '22 15:08 alexarchambault

oh yeah, probably it's a good idea to name them

HyukjinKwon avatar Aug 25 '22 01:08 HyukjinKwon