• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Page Information

    Loading...
  1. Dashboard
  2. Undefined Space
  3. Loom
  4. Blocking

Blocking

  • Created by Alan Bateman, last modified on Oct 31, 2020

The following blocking operations are virtual thread friendly; these methods "release" the underlying carrier thread when the operation blocks.

APIMethod(s)Notes
java.lang.Threadsleep, joinjoin to wait for a virtual thread to terminate
java.util.concurrentAll blocking operations
java.net.Socketconnect, read, writeSocket constructors with a host name parameter may need to do a lookup with InetAddress, see below
java.net.ServerSocketaccept
java.net.DatagramSocket/MulticastSocketreceiveconnect, disconnect and send do not block
java.nio.channels.SocketChannelconnect, read, writesocket adaptor connect, read, and write also okay
java.nio.channels.ServerSocketChannelacceptsocket adaptor accept also okay
java.nio.channels.DatagramChannelread, receive

socket adaptor receive also okay
connect, disconnect, send, and write do not block 

java.nio.channels.Pipe.SourceChannelread
java.nio.channels.Pipe.SinkChannelwrite
Console streams (System.in, out, err)read, write, printfLinux/macOS only at this time.


The following blocking operations use the ForkJoinPool.ManagedBocker mechanism when invoked from a virtual thread. Parallelism is temporarily extended until the blocking operation completes.

APIMethod(s)
java.lang.Objectwait
java.io.FileAll file I/O operations
java.io.FileInputStreamopen, read, skip
java.io.FileOutputStreamopen, write
java.io.RandomAccessFileopen, read, write, seek
java.net.InetAddressAll lookup operations
java.nio.MappedByteBufferforce
java.nio.channels.SelectorAll blocking selection operations
java.nio.channels.FileChannelread, write, lock, truncate, force, transferTo
java.nio.fileAll file I/O operations


The following blocking operations use the ForkJoinPool.ManagedBocker mechanism by way of operations in the previous table.

APIMethod(s)Notes
java.lang.Threadjoinjoin to wait for a kernel thread to terminate
java.io.Consoleread, write, printfWindows only
java.lang.Processinput/output/error streams



Overview
Content Tools
ThemeBuilder
  • No labels

Terms of Use
• License: GPLv2
• Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Kolekti ThemeBuilder Powered by Atlassian Confluence 8.5.21
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 182, "requestCorrelationId": "a71cc2299ae5bba5"}