Do not use java.util.zip.Checksum 69/110569/3
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 9 Mar 2024 14:32:01 +0000 (15:32 +0100)
committerRobert Varga <nite@hq.sk>
Mon, 11 Mar 2024 12:51:11 +0000 (12:51 +0000)
We are using this interface only for local variable type declaration,
use CRC32 directly, just as MappedJournalSegmentWriter does.

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

index 62e0002a38b7321019bbb77c1842e7420feae779..b399b5f9c83872daeaafd138e417689e8e83ccad 100644 (file)
@@ -24,7 +24,6 @@ import java.nio.BufferUnderflowException;
 import java.nio.ByteBuffer;
 import java.nio.channels.FileChannel;
 import java.util.zip.CRC32;
-import java.util.zip.Checksum;
 
 /**
  * Segment writer.
@@ -97,7 +96,7 @@ class FileChannelJournalSegmentWriter<E> implements JournalWriter<E> {
         final long checksum = memory.getInt() & 0xFFFFFFFFL;
 
         // Compute the checksum for the entry bytes.
-        final Checksum crc32 = new CRC32();
+        final CRC32 crc32 = new CRC32();
         crc32.update(memory.array(), memory.position(), length);
 
         // If the stored checksum equals the computed checksum, return the entry.
@@ -207,7 +206,7 @@ class FileChannelJournalSegmentWriter<E> implements JournalWriter<E> {
       }
 
       // Compute the checksum for the entry.
-      final Checksum crc32 = new CRC32();
+      final CRC32 crc32 = new CRC32();
       crc32.update(memory.array(), Integer.BYTES + Integer.BYTES, memory.limit() - (Integer.BYTES + Integer.BYTES));
       final long checksum = crc32.getValue();