From 7e354243af9e68a82592f029ce216caa3393ed62 Mon Sep 17 00:00:00 2001 From: JeonDaehong Date: Sun, 8 Sep 2024 14:28:45 +0900 Subject: [PATCH] Refactor: Use a single definition of MAX_SEGMENT_SIZE in Segment - Changed MAX_SEGMENT_SIZE in Segment.java to be public. - Updated SegmentDataUtils.java to use the MAX_SEGMENT_SIZE from Segment by importing it statically. - Removed the redundant definition of MAX_SEGMENT_SIZE in SegmentDataUtils to avoid duplication. --- .../main/java/org/apache/jackrabbit/oak/segment/Segment.java | 2 +- .../apache/jackrabbit/oak/segment/data/SegmentDataUtils.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Segment.java b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Segment.java index e488699a95f..9eee45259b9 100644 --- a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Segment.java +++ b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Segment.java @@ -96,7 +96,7 @@ public class Segment { /** * Maximum segment size */ - static final int MAX_SEGMENT_SIZE = 1 << 18; // 256kB + public static final int MAX_SEGMENT_SIZE = 1 << 18; // 256kB /** * The size limit for small values. The variable length of small values diff --git a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/data/SegmentDataUtils.java b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/data/SegmentDataUtils.java index dd52d7d2d53..17eaf86a019 100644 --- a/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/data/SegmentDataUtils.java +++ b/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/data/SegmentDataUtils.java @@ -24,6 +24,8 @@ import org.apache.commons.io.HexDump; import org.apache.jackrabbit.oak.commons.Buffer; +import static org.apache.jackrabbit.oak.segment.Segment.MAX_SEGMENT_SIZE; + class SegmentDataUtils { @@ -31,8 +33,6 @@ private SegmentDataUtils() { // Prevent instantiation } - private static final int MAX_SEGMENT_SIZE = 1 << 18; - static void hexDump(Buffer buffer, OutputStream stream) throws IOException { byte[] data = new byte[buffer.remaining()]; buffer.duplicate().get(data);