Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Virtual Thread - 導入の背景と、効果的な使い方 -

Virtual Thread - 導入の背景と、効果的な使い方 -

2023.01.21 ブリ会議 発表資料

Yuichi.Sakuraba

January 21, 2023
Tweet

More Decks by Yuichi.Sakuraba

Other Decks in Technology

Transcript

  1. - -

  2. • • • • • •

  3. • • • •

  4. • • • →

  5. None
  6. • • • → •

  7. • • • • •

  8. public class ThreadPoolExecutor extends AbstractExecutorService { ... private final class

    Worker extends AbstractQueuedSynchronizer implements Runnable { Worker(Runnable firstTask) { setState(-1); this.firstTask = firstTask; this.thread = getThreadFactory().newThread(this); } ...
  9. • • •

  10. • • • • • • •

  11. • • •

  12. • • • • • • •

  13. None
  14. None
  15. None
  16. None
  17. None
  18. int blockingRead(byte[] b, int off, int len, long nanos) throws

    IOException { ... // read, no timeout configureSocketNonBlockingIfVirtualThread(); n = tryRead(b, off, len); while (IOStatus.okayToRetry(n) && isOpen()) { park(Net.POLLIN); n = tryRead(b, off, len); } ...
  19. • • • • • • • •

  20. • • • • •

  21. • • • •

  22. • • • •

  23. • • • • • • •

  24. • • • • • • •

  25. - -