uli
08/30/2018, 9:10 AMByteReadChannel.copyTo(WritableByteChannel)
is documented to only work with blocking NIO channelsDeactivated User
08/30/2018, 9:13 AMuli
08/30/2018, 9:15 AMByteReadChannel
created via HttpResponse.content to a file channelDeactivated User
08/30/2018, 9:16 AMuli
08/30/2018, 9:16 AMval networkChannel = httpResponse.content
FileChannel.open(tmpPath,
StandardOpenOption.WRITE,
StandardOpenOption.TRUNCATE_EXISTING).use { targetChannel ->
networkChannel.copyTo(targetChannel)
}
uli
08/30/2018, 9:17 AMuli
08/30/2018, 9:17 AMcopyTo
comes from kotlinx.coroutines.experimental.io.jvm.nio. WritingKt
Deactivated User
08/30/2018, 9:20 AMByteReadChannel
from kotlinx-io into a https://docs.oracle.com/javase/7/docs/api/java/nio/channels/AsynchronousFileChannel.html ?uli
08/30/2018, 9:20 AMDeactivated User
08/30/2018, 9:20 AMuli
08/30/2018, 9:20 AMDeactivated User
08/30/2018, 9:20 AMDeactivated User
08/30/2018, 9:21 AMuli
08/30/2018, 9:21 AMDeactivated User
08/30/2018, 9:21 AMAn AsynchronousFileChannel is associated with a thread pool to which tasks are submitted to handle I/O events and dispatch to completion handlers that consume the results of I/O operations on the channel. The completion handler for an I/O operation initiated on a channel is guaranteed to be invoked by one of the threads in the thread pool (This ensures that the completion handler is run by a thread with the expected identity). Where an I/O operation completes immediately, and the initiating thread is itself a thread in the thread pool, then the completion handler may be invoked directly by the initiating thread. When an AsynchronousFileChannel is created without specifying a thread pool then the channel is associated with a system-dependent default thread pool that may be shared with other channels. The default thread pool is configured by the system properties defined by the AsynchronousChannelGroup class.
uli
08/30/2018, 9:22 AMDeactivated User
08/30/2018, 9:23 AMuli
08/30/2018, 9:25 AMassociated with a thread pool to which tasks are submitted to handle I/O events
and `This ensures that the completion handler is run by a thread with the expected identity``
both sound non-blocking to me. It does not read as if the actual IO would be performed in the thread pool.Deactivated User
08/30/2018, 9:26 AMDeactivated User
08/30/2018, 9:26 AMDeactivated User
08/30/2018, 9:26 AMDeactivated User
08/30/2018, 9:27 AMDeactivated User
08/30/2018, 9:28 AMuli
08/30/2018, 9:28 AMuli
08/30/2018, 9:29 AMDeactivated User
08/30/2018, 9:29 AMuli
08/30/2018, 9:29 AMuli
08/30/2018, 9:30 AMDeactivated User
08/30/2018, 9:33 AMuli
08/30/2018, 9:53 AMcy
08/30/2018, 10:39 AMAsynchronousChannel
is running a blocking operations on a separate pool in fact. This is because files are always blocking due to underlying native implementation except Windows.rocketraman
08/31/2018, 8:27 AM