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. 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); } ...
  3. 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); } ...
  4. - -