Author: mduerig
Date: Wed May 27 14:22:24 2015
New Revision: 1682041
URL: http://svn.apache.org/r1682041
Log:
OAK-2833: Refactor TarMK
Minor cleanup
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Segment.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTracker.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/compaction/CompactionStrategy.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/gc/GCMonitor.java
jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTestUtils.java
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Segment.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Segment.java?rev=1682041&r1=1682040&r2=1682041&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Segment.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/Segment.java
Wed May 27 14:22:24 2015
@@ -97,11 +97,11 @@ public class Segment {
*/
public static final int MEDIUM_LIMIT = (1 << (16 - 2)) + SMALL_LIMIT;
- public static int REF_COUNT_OFFSET = 5;
+ public static final int REF_COUNT_OFFSET = 5;
- static int ROOT_COUNT_OFFSET = 6;
+ static final int ROOT_COUNT_OFFSET = 6;
- static int BLOBREF_COUNT_OFFSET = 8;
+ static final int BLOBREF_COUNT_OFFSET = 8;
private final SegmentTracker tracker;
@@ -420,7 +420,7 @@ public class Segment {
RecordId primaryId = readRecordId(offset);
primaryType = PropertyStates.createProperty(
"jcr:primaryType", readString(primaryId), Type.NAME);
- offset += Segment.RECORD_ID_BYTES;
+ offset += RECORD_ID_BYTES;
}
PropertyState mixinTypes = null;
@@ -429,7 +429,7 @@ public class Segment {
for (int i = 0; i < mixins.length; i++) {
RecordId mixinId = readRecordId(offset);
mixins[i] = readString(mixinId);
- offset += Segment.RECORD_ID_BYTES;
+ offset += RECORD_ID_BYTES;
}
mixinTypes = PropertyStates.createProperty(
"jcr:mixinTypes", Arrays.asList(mixins), Type.NAMES);
@@ -441,7 +441,7 @@ public class Segment {
} else if (!zeroChildNodes) {
RecordId childNameId = readRecordId(offset);
childName = readString(childNameId);
- offset += Segment.RECORD_ID_BYTES;
+ offset += RECORD_ID_BYTES;
}
PropertyTemplate[] properties;
@@ -457,7 +457,7 @@ public class Segment {
PropertyTemplate[] properties = new PropertyTemplate[propertyCount];
for (int i = 0; i < propertyCount; i++) {
RecordId propertyNameId = readRecordId(offset);
- offset += Segment.RECORD_ID_BYTES;
+ offset += RECORD_ID_BYTES;
byte type = readByte(offset++);
properties[i] = new PropertyTemplate(i, readString(propertyNameId),
Type.fromTag(Math.abs(type), type < 0));
@@ -470,7 +470,7 @@ public class Segment {
if (propertyCount > 0) {
RecordId id = readRecordId(offset);
ListRecord propertyNames = new ListRecord(id, properties.length);
- offset += Segment.RECORD_ID_BYTES;
+ offset += RECORD_ID_BYTES;
for (int i = 0; i < propertyCount; i++) {
byte type = readByte(offset++);
properties[i] = new PropertyTemplate(i,
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java?rev=1682041&r1=1682040&r2=1682041&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java
Wed May 27 14:22:24 2015
@@ -188,7 +188,7 @@ public class SegmentNodeStoreService ext
" compacted commits after the maximum number of retries
has been reached. " +
"Force committing tries to exclusively write lock the node
store."
)
- public static String COMPACTION_FORCE_AFTER_FAIL =
"compaction.forceAfterFail";
+ public static final String COMPACTION_FORCE_AFTER_FAIL =
"compaction.forceAfterFail";
public static final int COMPACTION_LOCK_WAIT_TIME_DEFAULT = 60;
@Property(
@@ -493,6 +493,7 @@ public class SegmentNodeStoreService ext
* needed for situations where you have to unwrap the
* SegmentNodeStoreService, to get the SegmentStore, like the failover
*/
+ @Override
public SegmentStore getSegmentStore() {
return store;
}
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTracker.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTracker.java?rev=1682041&r1=1682040&r2=1682041&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTracker.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTracker.java
Wed May 27 14:22:24 2015
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.oak.plugin
import static com.google.common.collect.Lists.newLinkedList;
import static com.google.common.collect.Queues.newArrayDeque;
import static com.google.common.collect.Sets.newHashSet;
-import static com.google.common.collect.Sets.newIdentityHashSet;
import java.security.SecureRandom;
import java.util.LinkedList;
@@ -29,7 +28,6 @@ import java.util.concurrent.atomic.Atomi
import javax.annotation.Nonnull;
-import com.google.common.collect.Sets;
import org.apache.jackrabbit.oak.plugins.blob.ReferenceCollector;
import org.apache.jackrabbit.oak.plugins.segment.compaction.CompactionStrategy;
import org.slf4j.Logger;
@@ -82,7 +80,7 @@ public class SegmentTracker {
/**
* Hash table of weak references to segment identifiers that are
* currently being accessed. The size of the table is always a power
- * of two, which optimizes the {@link #expand()} operation. The table is
+ * of two, which optimizes the {@code refresh} operation. The table is
* indexed by the random identifier bits, which guarantees uniform
* distribution of entries. Each table entry is either {@code null}
* (when there are no matching identifiers) or a list of weak references
@@ -251,8 +249,8 @@ public class SegmentTracker {
}
public synchronized void clearSegmentIdTables(CompactionStrategy strategy)
{
- for (int i = 0; i < tables.length; i++) {
- tables[i].clearSegmentIdTables(strategy);
+ for (SegmentIdTable table : tables) {
+ table.clearSegmentIdTables(strategy);
}
}
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/compaction/CompactionStrategy.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/compaction/CompactionStrategy.java?rev=1682041&r1=1682040&r2=1682041&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/compaction/CompactionStrategy.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/compaction/CompactionStrategy.java
Wed May 27 14:22:24 2015
@@ -89,7 +89,7 @@ public abstract class CompactionStrategy
/**
* No compaction at all
*/
- public static CompactionStrategy NO_COMPACTION = new CompactionStrategy(
+ public static final CompactionStrategy NO_COMPACTION = new
CompactionStrategy(
true, false, CleanupType.CLEAN_NONE, 0, MEMORY_THRESHOLD_DEFAULT) {
@Override
public boolean compacted(@Nonnull Callable<Boolean> setHead) throws
Exception {
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java?rev=1682041&r1=1682040&r2=1682041&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/file/FileStore.java
Wed May 27 14:22:24 2015
@@ -482,8 +482,7 @@ public class FileStore implements Segmen
return compacted;
}
- static Map<Integer, Map<Character, File>> collectFiles(File directory)
- throws IOException {
+ static Map<Integer, Map<Character, File>> collectFiles(File directory) {
Map<Integer, Map<Character, File>> dataFiles = newHashMap();
Map<Integer, File> bulkFiles = newHashMap();
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/gc/GCMonitor.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/gc/GCMonitor.java?rev=1682041&r1=1682040&r2=1682041&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/gc/GCMonitor.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/gc/GCMonitor.java
Wed May 27 14:22:24 2015
@@ -78,5 +78,5 @@ public interface GCMonitor {
@Override public void skipped(String reason, Object[] arguments) { }
@Override public void compacted() { }
@Override public void cleaned(long reclaimedSize, long currentSize) { }
- };
+ }
}
Modified:
jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTestUtils.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTestUtils.java?rev=1682041&r1=1682040&r2=1682041&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTestUtils.java
(original)
+++
jackrabbit/oak/trunk/oak-tarmk-standby/src/test/java/org/apache/jackrabbit/oak/plugins/segment/SegmentTestUtils.java
Wed May 27 14:22:24 2015
@@ -18,13 +18,6 @@
*/
package org.apache.jackrabbit.oak.plugins.segment;
-import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.plugins.segment.file.FileStore;
-import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
-import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
-import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
-
import static java.io.File.createTempFile;
import static
org.apache.jackrabbit.oak.plugins.segment.Segment.MAX_SEGMENT_SIZE;
import static
org.apache.jackrabbit.oak.plugins.segment.Segment.RECORD_ALIGN_BITS;
@@ -34,11 +27,16 @@ import java.io.File;
import java.io.IOException;
import java.util.Random;
-public class SegmentTestUtils {
+import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.plugins.segment.file.FileStore;
+import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
+import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
+import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
- private SegmentTestUtils() {
+public final class SegmentTestUtils {
- }
+ private SegmentTestUtils() { }
public static int newValidOffset(Random random) {
return random.nextInt(MAX_SEGMENT_SIZE >> RECORD_ALIGN_BITS) <<
RECORD_ALIGN_BITS;