Author: frm Date: Mon Jun 18 12:33:47 2018 New Revision: 1833711 URL: http://svn.apache.org/viewvc?rev=1833711&view=rev Log: OAK-7550 - Make running cleanup before compaction the default strategy
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java Modified: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java?rev=1833711&r1=1833710&r2=1833711&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java (original) +++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java Mon Jun 18 12:33:47 2018 @@ -65,6 +65,13 @@ public class FileStore extends AbstractF private static final int MB = 1024 * 1024; + private static GarbageCollectionStrategy newGarbageCollectionStrategy() { + if (Boolean.getBoolean("gc.classic")) { + return new SynchronizedGarbageCollectionStrategy(new DefaultGarbageCollectionStrategy()); + } + return new SynchronizedGarbageCollectionStrategy(new CleanupFirstGarbageCollectionStrategy()); + } + @Nonnull private final SegmentWriter segmentWriter; @@ -108,15 +115,7 @@ public class FileStore extends AbstractF @Nonnull private final SegmentNotFoundExceptionListener snfeListener; - private final GarbageCollectionStrategy garbageCollectionStrategy; - - { - if (Boolean.getBoolean("gc.cleanup.first")) { - garbageCollectionStrategy = new SynchronizedGarbageCollectionStrategy(new CleanupFirstGarbageCollectionStrategy()); - } else { - garbageCollectionStrategy = new SynchronizedGarbageCollectionStrategy(new DefaultGarbageCollectionStrategy()); - } - } + private final GarbageCollectionStrategy garbageCollectionStrategy = newGarbageCollectionStrategy(); FileStore(final FileStoreBuilder builder) throws InvalidFileStoreVersionException, IOException { super(builder);