Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
ptirador opened this issue Oct 30, 2020 · 0 comments · Fixed by #135
Closed
2 tasks done
Labels
hacktoberfest Pre-selected issues for Hacktoberfest help wanted Extra attention is needed
Milestone

Comments

@ptirador
Copy link
Contributor

ptirador commented Oct 30, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest Pre-selected issues for Hacktoberfest help wanted Extra attention is needed
Projects
None yet
2 participants