Skip to content

Switch the NIO implementation to use AsynchronousFileChannel instead of FileChannel #99

@ptirador

Description

@ptirador

Task Description

The AWS SDK for Java 2.x utilizes a new, non-blocking SDK architecture built on Netty to support true non-blocking I/O. Taking advantage of it, we can also switch the NIO implementation to use AsynchronousFileChannel. This should give a significant performance boost.

A plain FileChannel implements InterruptibleChannel so it, as well as anything that uses it such as the OutputStream returned by Files.newOutputStream(), has the unfortunate [1], [2] behaviour that performing any blocking operation on it (e.g. read() and write()) in a thread in interrupted state will cause the Channel itself to close with java.nio.channels.ClosedByInterruptException.

If this is a problem, using AsynchronousFileChannel instead is a possible alternative.

Tasks

The following tasks will need to be carried out:

  • Make S3FileChannel extend AsynchronousFileChannel instead of FileChannel and override the respective methods associated to this new class.
  • Make S3FileSystemProvider override the method newAsynchronousFileChannel instead of newFileChannel from FileSystemProvider.

Task Relationships

This task:

Useful Links

Help

Metadata

Metadata

Assignees

No one assigned

    Labels

    hacktoberfestPre-selected issues for Hacktoberfesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions