Skip to content

Commit

Permalink
@trivial: make field final, rename constant, re-align code
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1745165 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mduerig committed May 23, 2016
1 parent b5a2052 commit b91d948
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public class Segment {

static final int BLOBREF_COUNT_OFFSET = 8;

public static final int GC_GEN_OFFSET = 10;
public static final int GC_GENERATION_OFFSET = 10;

private final SegmentTracker tracker;

Expand Down Expand Up @@ -300,7 +300,7 @@ public int getRootCount() {
*/
public static int getGcGeneration(ByteBuffer data, UUID segmentId) {
return isDataSegmentId(segmentId.getLeastSignificantBits())
? data.getInt(GC_GEN_OFFSET)
? data.getInt(GC_GENERATION_OFFSET)
: 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import static java.lang.System.arraycopy;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.identityHashCode;
import static org.apache.jackrabbit.oak.segment.Segment.GC_GEN_OFFSET;
import static org.apache.jackrabbit.oak.segment.Segment.GC_GENERATION_OFFSET;
import static org.apache.jackrabbit.oak.segment.Segment.MAX_SEGMENT_SIZE;
import static org.apache.jackrabbit.oak.segment.Segment.RECORD_ID_BYTES;
import static org.apache.jackrabbit.oak.segment.Segment.SEGMENT_REFERENCE_LIMIT;
Expand Down Expand Up @@ -158,10 +158,10 @@ private void newSegment() {
buffer[4] = 0; // reserved
buffer[5] = 0; // refcount

buffer[GC_GEN_OFFSET] = (byte) (generation >> 24);
buffer[GC_GEN_OFFSET + 1] = (byte) (generation >> 16);
buffer[GC_GEN_OFFSET + 2] = (byte) (generation >> 8);
buffer[GC_GEN_OFFSET + 3] = (byte) generation;
buffer[GC_GENERATION_OFFSET] = (byte) (generation >> 24);
buffer[GC_GENERATION_OFFSET + 1] = (byte) (generation >> 16);
buffer[GC_GENERATION_OFFSET + 2] = (byte) (generation >> 8);
buffer[GC_GENERATION_OFFSET + 3] = (byte) generation;
length = 0;
position = buffer.length;
roots.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static boolean isDataSegmentId(long lsb) {

private final long lsb;

private long creationTime;
private final long creationTime;

/**
* A reference to the segment object, if it is available in memory. It is
Expand Down Expand Up @@ -168,9 +168,9 @@ public UUID asUUID() {

@Override
public int compareTo(SegmentId that) {
int d = Long.valueOf(this.msb).compareTo(Long.valueOf(that.msb));
int d = Long.valueOf(this.msb).compareTo(that.msb);
if (d == 0) {
d = Long.valueOf(this.lsb).compareTo(Long.valueOf(that.lsb));
d = Long.valueOf(this.lsb).compareTo(that.lsb);
}
return d;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ public void evicted(SegmentId segmentId, Segment segment, RemovalCause cause) {
segmentId.setSegment(null);
}
}
})
.build();
}).build();
}

public SegmentTracker(SegmentStore store, SegmentVersion version) {
Expand Down

0 comments on commit b91d948

Please sign in to comment.