Clean up initial FileChannel writer reset's read 67/110567/2
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 9 Mar 2024 14:13:20 +0000 (15:13 +0100)
committerRobert Varga <nite@hq.sk>
Mon, 11 Mar 2024 12:51:11 +0000 (12:51 +0000)
commit62351d41be04a723dce6c1268475f27a0ca0dfe6
tree9f84009acd6b8a53b13c3535f621344906e902da
parent5b9d16d22b8645011f8a79167da4d31a46195327
Clean up initial FileChannel writer reset's read

The code here bears marks of 'copy, paste and cudgel to compliance'
programming and is strikingly similar to what MappedJournalSegmentWriter
does -- except it needs to deal with reading as well.

This patch takes the first step towards sanity by eliminating a useless
if() and uses FileChannel.read(ByteBuffer, long) to reduce position
adjustments.

JIRA: CONTROLLER-2095
Change-Id: I528cb14608402a406e20d168a7e8520c9eb66edf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
atomix-storage/src/main/java/io/atomix/storage/journal/FileChannelJournalSegmentWriter.java