jetty.project icon indicating copy to clipboard operation
jetty.project copied to clipboard

Issue#11353 - Default virtual thread executor should created named threads

Open danishnawab opened this issue 1 year ago • 2 comments

Specify a ThreadFactory when setting up the default virtual thread executor so it creates named threads.

(issue #11353)

Tested the reflective logic in probeVirtualThreadExecutor against different JDK versions for compatibility reasons:

  • 19 (preview) ✅
  • 20 (preview) ✅
  • 21 ✅

Likewise, it does not work on the previous versions (JDK 18 and below) as virtual threads were only introduced in JDK 19 (preview). For older JDKs, the behavior remains the same as before:

  • VirtualThreads#getDefaultVirtualThreadsExecutor reutrns null
  • VirtualThreads#areSupported returns false

danishnawab avatar Jan 30 '24 09:01 danishnawab

Any changes to Jetty 12 must not fail / crash on JDK 17 as well (as that is our minimum JDK version). I see you put a big red ❌ on JDK 17 in your initial comment, so that makes me nervous, but the CI build is happy and green. So what did you do?

joakime avatar Jan 30 '24 13:01 joakime

Any changes to Jetty 12 must not fail / crash on JDK 17 as well (as that is our minimum JDK version). I see you put a big red ❌ on JDK 17 in your initial comment, so that makes me nervous, but the CI build is happy and green. So what did you do?

This was in reference to Simon's comment here: https://github.com/jetty/jetty.project/issues/11353#issuecomment-1916364459

What I meant to say was that the reflective code fails (as expected) on JDK 17 because there was no support for virtual threads prior to JDK 19 (preview). The build passes successfully and so do all tests on both JDK 17 and 21.

I can see how the description can be confusing. I will update it accordingly.

danishnawab avatar Jan 30 '24 14:01 danishnawab

Superseded by #11430

danishnawab avatar Feb 21 '24 15:02 danishnawab