Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentTracker.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentTracker.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentTracker.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentTracker.java Wed Nov 7 14:34:38 2018 @@ -26,7 +26,7 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.atomic.AtomicInteger; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * Tracker of references to segment identifiers and segment instances @@ -47,7 +47,7 @@ public class SegmentTracker implements S /** * The random number source for generating new segment identifiers. */ - @Nonnull + @NotNull private final SecureRandom random = new SecureRandom(); /** @@ -59,19 +59,19 @@ public class SegmentTracker implements S * (when there are no matching identifiers) or a list of weak references * to the matching identifiers. */ - @Nonnull + @NotNull private final SegmentIdTable[] tables = new SegmentIdTable[32]; /** * Number of segment tracked since this tracker was instantiated */ - @Nonnull + @NotNull private final AtomicInteger segmentCounter = new AtomicInteger(); - @Nonnull + @NotNull private final SegmentIdFactory segmentIdFactory; - public SegmentTracker(@Nonnull SegmentIdFactory segmentIdFactory) { + public SegmentTracker(@NotNull SegmentIdFactory segmentIdFactory) { this.segmentIdFactory = checkNotNull(segmentIdFactory); for (int i = 0; i < tables.length; i++) { tables[i] = new SegmentIdTable(); @@ -105,7 +105,7 @@ public class SegmentTracker implements S * @return the segment id */ @Override - @Nonnull + @NotNull public SegmentId newSegmentId(long msb, long lsb) { int index = ((int) msb) & (tables.length - 1); return tables[index].newSegmentId(msb, lsb, segmentIdFactory); @@ -117,7 +117,7 @@ public class SegmentTracker implements S * @return the segment id */ @Override - @Nonnull + @NotNull public SegmentId newDataSegmentId() { return newSegmentId(DATA); } @@ -128,12 +128,12 @@ public class SegmentTracker implements S * @return the segment id */ @Override - @Nonnull + @NotNull public SegmentId newBulkSegmentId() { return newSegmentId(BULK); } - @Nonnull + @NotNull private SegmentId newSegmentId(long type) { segmentCounter.incrementAndGet(); long msb = (random.nextLong() & MSB_MASK) | VERSION; @@ -141,7 +141,7 @@ public class SegmentTracker implements S return newSegmentId(msb, lsb); } - public synchronized void clearSegmentIdTables(@Nonnull Set<UUID> reclaimed, @Nonnull String gcInfo) { + public synchronized void clearSegmentIdTables(@NotNull Set<UUID> reclaimed, @NotNull String gcInfo) { for (SegmentIdTable table : tables) { table.clearSegmentIdTables(reclaimed, gcInfo); }
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentWriter.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentWriter.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentWriter.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentWriter.java Wed Nov 7 14:34:38 2018 @@ -23,12 +23,11 @@ import java.nio.ByteBuffer; import java.util.List; import java.util.Map; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import org.apache.jackrabbit.oak.api.Blob; import org.apache.jackrabbit.oak.api.PropertyState; import org.apache.jackrabbit.oak.spi.state.NodeState; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Converts nodes, properties, values, etc. to records and persists them. @@ -46,9 +45,9 @@ public interface SegmentWriter { * @return the record id of the map written * @throws IOException */ - @Nonnull + @NotNull // TODO frm this method is only used from test code, should it be removed? - RecordId writeMap(@Nullable MapRecord base, @Nonnull Map<String, RecordId> changes) throws IOException; + RecordId writeMap(@Nullable MapRecord base, @NotNull Map<String, RecordId> changes) throws IOException; /** * Write a list record. @@ -57,9 +56,9 @@ public interface SegmentWriter { * @return the record id of the list written * @throws IOException */ - @Nonnull + @NotNull // TODO frm this method is only used from test code, should it be removed? - RecordId writeList(@Nonnull List<RecordId> list) throws IOException; + RecordId writeList(@NotNull List<RecordId> list) throws IOException; /** * Write a string record. @@ -68,9 +67,9 @@ public interface SegmentWriter { * @return the record id of the string written. * @throws IOException */ - @Nonnull + @NotNull // TODO frm this method is only used from test code, should it be removed? - RecordId writeString(@Nonnull String string) throws IOException; + RecordId writeString(@NotNull String string) throws IOException; /** * Write a blob (as list of block records) @@ -79,8 +78,8 @@ public interface SegmentWriter { * @return the record id of the blob written * @throws IOException */ - @Nonnull - RecordId writeBlob(@Nonnull Blob blob) throws IOException; + @NotNull + RecordId writeBlob(@NotNull Blob blob) throws IOException; /** * Writes a block record containing the given block of bytes. @@ -90,9 +89,9 @@ public interface SegmentWriter { * @param length number of bytes to write * @return the record id of the block written */ - @Nonnull + @NotNull // TODO frm this method is only used from test code, should it be removed? - RecordId writeBlock(@Nonnull byte[] bytes, int offset, int length) throws IOException; + RecordId writeBlock(@NotNull byte[] bytes, int offset, int length) throws IOException; /** * Writes a stream value record. The given stream is consumed <em>and @@ -103,8 +102,8 @@ public interface SegmentWriter { * @throws IOException if the input stream could not be read or the output * could not be written */ - @Nonnull - RecordId writeStream(@Nonnull InputStream stream) throws IOException; + @NotNull + RecordId writeStream(@NotNull InputStream stream) throws IOException; /** * Write a property. @@ -113,9 +112,9 @@ public interface SegmentWriter { * @return the record id of the property state written * @throws IOException */ - @Nonnull + @NotNull // TODO frm this method is only used from test code, should it be removed? - RecordId writeProperty(@Nonnull PropertyState state) throws IOException; + RecordId writeProperty(@NotNull PropertyState state) throws IOException; /** * Write a node state. If non null, the passed {@code stableId} will be assigned to @@ -126,8 +125,8 @@ public interface SegmentWriter { * @return the record id of the segment node state written * @throws IOException */ - @Nonnull - RecordId writeNode(@Nonnull NodeState state, @Nullable ByteBuffer stableIdBytes) throws IOException; + @NotNull + RecordId writeNode(@NotNull NodeState state, @Nullable ByteBuffer stableIdBytes) throws IOException; /** * Write a node state. @@ -136,8 +135,8 @@ public interface SegmentWriter { * * @see #writeNode(NodeState, ByteBuffer) */ - @Nonnull - default RecordId writeNode(@Nonnull NodeState state) throws IOException { + @NotNull + default RecordId writeNode(@NotNull NodeState state) throws IOException { return writeNode(state, null); } } Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Template.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Template.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Template.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Template.java Wed Nov 7 14:34:38 2018 @@ -30,10 +30,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import com.google.common.base.Objects; import com.google.common.collect.Lists; import org.apache.jackrabbit.oak.api.PropertyState; @@ -42,6 +38,8 @@ import org.apache.jackrabbit.oak.commons import org.apache.jackrabbit.oak.plugins.memory.MemoryChildNodeEntry; import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry; import org.apache.jackrabbit.oak.spi.state.NodeState; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * The in-memory representation of a "hidden class" of a node; inspired by the @@ -61,28 +59,28 @@ public class Template { static final String MANY_CHILD_NODES = ""; - @Nonnull + @NotNull private final SegmentReader reader; /** * The {@code jcr:primaryType} property, if present as a single-valued * {@code NAME} property. Otherwise {@code null}. */ - @CheckForNull + @Nullable private final PropertyState primaryType; /** * The {@code jcr:mixinTypes} property, if present as a multi-valued * {@code NAME} property. Otherwise {@code null}. */ - @CheckForNull + @Nullable private final PropertyState mixinTypes; /** * Templates of all the properties of a node, excluding the * above-mentioned {@code NAME}-valued type properties, if any. */ - @Nonnull + @NotNull private final PropertyTemplate[] properties; /** @@ -90,10 +88,10 @@ public class Template { * Otherwise {@link #ZERO_CHILD_NODES} (i.e. {@code null}) if there are * no children, or {@link #MANY_CHILD_NODES} if there are more than one. */ - @CheckForNull + @Nullable private final String childName; - Template(@Nonnull SegmentReader reader, + Template(@NotNull SegmentReader reader, @Nullable PropertyState primaryType, @Nullable PropertyState mixinTypes, @Nullable PropertyTemplate[] properties, @@ -110,7 +108,7 @@ public class Template { this.childName = childName; } - Template(@Nonnull SegmentReader reader, @Nonnull NodeState state) { + Template(@NotNull SegmentReader reader, @NotNull NodeState state) { this.reader = checkNotNull(reader); checkNotNull(state); PropertyState primary = null; @@ -146,12 +144,12 @@ public class Template { } } - @CheckForNull + @Nullable PropertyState getPrimaryType() { return primaryType; } - @CheckForNull + @Nullable PropertyState getMixinTypes() { return mixinTypes; } @@ -186,7 +184,7 @@ public class Template { return null; } - @CheckForNull + @Nullable String getChildName() { return childName; } Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriteOperationHandler.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriteOperationHandler.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriteOperationHandler.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriteOperationHandler.java Wed Nov 7 14:34:38 2018 @@ -21,7 +21,7 @@ package org.apache.jackrabbit.oak.segmen import java.io.IOException; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * A {@code WriteOperationHandler} executes {@link WriteOperation @@ -44,8 +44,8 @@ interface WriteOperationHandler { * @return {@code RecordId} that resulted from persisting the changes. * @throws IOException */ - @Nonnull - RecordId execute(@Nonnull SegmentBufferWriter writer) throws IOException; + @NotNull + RecordId execute(@NotNull SegmentBufferWriter writer) throws IOException; } /** @@ -54,13 +54,13 @@ interface WriteOperationHandler { * @return {@code RecordId} that resulted from persisting the changes. * @throws IOException */ - @Nonnull - RecordId execute(@Nonnull WriteOperation writeOperation) throws IOException; + @NotNull + RecordId execute(@NotNull WriteOperation writeOperation) throws IOException; /** * Flush any pending changes on any {@link SegmentBufferWriter} managed by this instance. * @param store the {@code SegmentStore} instance to write the {@code Segment} to * @throws IOException */ - void flush(@Nonnull SegmentStore store) throws IOException; + void flush(@NotNull SegmentStore store) throws IOException; } Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriterCacheManager.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriterCacheManager.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriterCacheManager.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriterCacheManager.java Wed Nov 7 14:34:38 2018 @@ -29,10 +29,6 @@ import static org.apache.jackrabbit.oak. import java.util.Iterator; import java.util.concurrent.ConcurrentMap; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.base.Supplier; @@ -40,6 +36,8 @@ import com.google.common.cache.CacheStat import org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean; import org.apache.jackrabbit.oak.segment.file.PriorityCache; import org.apache.jackrabbit.oak.stats.StatisticsProvider; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Instances of this class manage the deduplication caches used by the {@link @@ -89,20 +87,20 @@ public abstract class WriterCacheManager /** * @return cache for string records of the given {@code generation} and {@code operation}. */ - @Nonnull + @NotNull public abstract Cache<String, RecordId> getStringCache(int generation); /** * @param generation * @return cache for template records of the given {@code generation} and {@code operation}. */ - @Nonnull + @NotNull public abstract Cache<Template, RecordId> getTemplateCache(int generation); /** * @return cache for node records of the given {@code generation} and {@code operation}. */ - @Nonnull + @NotNull public abstract Cache<String, RecordId> getNodeCache(int generation); /** @@ -113,17 +111,17 @@ public abstract class WriterCacheManager * @param statisticsProvider * @return an instance of this cache with access statistics enabled. */ - @Nonnull + @NotNull public WriterCacheManager withAccessTracking( - @Nonnull String name, - @Nonnull StatisticsProvider statisticsProvider) { + @NotNull String name, + @NotNull StatisticsProvider statisticsProvider) { return new AccessTrackingCacheManager(checkNotNull(name), checkNotNull(statisticsProvider), this); } /** * @return statistics for the string cache or {@code null} if not available. */ - @CheckForNull + @Nullable public CacheStatsMBean getStringCacheStats() { return null; } @@ -131,7 +129,7 @@ public abstract class WriterCacheManager /** * @return statistics for the template cache or {@code null} if not available. */ - @CheckForNull + @Nullable public CacheStatsMBean getTemplateCacheStats() { return null; } @@ -139,7 +137,7 @@ public abstract class WriterCacheManager /** * @return statistics for the node cache or {@code null} if not available. */ - @CheckForNull + @Nullable public CacheStatsMBean getNodeCacheStats() { return null; } @@ -149,7 +147,7 @@ public abstract class WriterCacheManager * evictions per priority. * @return occupancy information for the node deduplication cache. */ - @CheckForNull + @Nullable public String getNodeCacheOccupancyInfo() { return null; } /** @@ -172,7 +170,7 @@ public abstract class WriterCacheManager /** * @return empty cache of size 0 */ - @Nonnull + @NotNull @Override public RecordCache<String> getStringCache(int generation) { return stringCache; @@ -181,7 +179,7 @@ public abstract class WriterCacheManager /** * @return empty cache of size 0 */ - @Nonnull + @NotNull @Override public RecordCache<Template> getTemplateCache(int generation) { return templateCache; @@ -190,21 +188,21 @@ public abstract class WriterCacheManager /** * @return a {@code Cache} cache that is always empty */ - @Nonnull + @NotNull @Override public Cache<String, RecordId> getNodeCache(int generation) { return new Cache<String, RecordId>() { @Override - public void put(@Nonnull String stableId, @Nonnull RecordId recordId, byte cost) { } + public void put(@NotNull String stableId, @NotNull RecordId recordId, byte cost) { } @Override - public void put(@Nonnull String key, @Nonnull RecordId value) { + public void put(@NotNull String key, @NotNull RecordId value) { throw new UnsupportedOperationException(); } - @CheckForNull + @Nullable @Override - public RecordId get(@Nonnull String stableId) { return null; } + public RecordId get(@NotNull String stableId) { return null; } }; } } @@ -243,9 +241,9 @@ public abstract class WriterCacheManager * @param nodeCacheFactory factory for the node cache */ public Default( - @Nonnull Supplier<RecordCache<String>> stringCacheFactory, - @Nonnull Supplier<RecordCache<Template>> templateCacheFactory, - @Nonnull Supplier<PriorityCache<String, RecordId>> nodeCacheFactory) { + @NotNull Supplier<RecordCache<String>> stringCacheFactory, + @NotNull Supplier<RecordCache<Template>> templateCacheFactory, + @NotNull Supplier<PriorityCache<String, RecordId>> nodeCacheFactory) { this.stringCaches = new Generations<>(stringCacheFactory); this.templateCaches = new Generations<>(templateCacheFactory); this.nodeCache = memoize(nodeCacheFactory); @@ -267,7 +265,7 @@ public abstract class WriterCacheManager private final ConcurrentMap<Integer, Supplier<T>> generations = newConcurrentMap(); private final Supplier<T> cacheFactory; - Generations(@Nonnull Supplier<T> cacheFactory) { + Generations(@NotNull Supplier<T> cacheFactory) { this.cacheFactory = checkNotNull(cacheFactory); } @@ -279,7 +277,7 @@ public abstract class WriterCacheManager return generations.get(generation).get(); } - @Nonnull + @NotNull @Override public Iterator<T> iterator() { return transform(generations.values().iterator(), new Function<Supplier<T>, T>() { @@ -290,7 +288,7 @@ public abstract class WriterCacheManager }); } - void evictGenerations(@Nonnull Predicate<Integer> evict) { + void evictGenerations(@NotNull Predicate<Integer> evict) { Iterator<Integer> it = generations.keySet().iterator(); while (it.hasNext()) { if (evict.apply(it.next())) { @@ -300,13 +298,13 @@ public abstract class WriterCacheManager } } - @Nonnull + @NotNull @Override public Cache<String, RecordId> getStringCache(int generation) { return stringCaches.getGeneration(generation); } - @Nonnull + @NotNull @Override public Cache<Template, RecordId> getTemplateCache(int generation) { return templateCaches.getGeneration(generation); @@ -317,28 +315,28 @@ public abstract class WriterCacheManager } @Override - @Nonnull + @NotNull public Cache<String, RecordId> getNodeCache(final int generation) { return new Cache<String, RecordId>() { @Override - public void put(@Nonnull String stableId, @Nonnull RecordId recordId, byte cost) { + public void put(@NotNull String stableId, @NotNull RecordId recordId, byte cost) { nodeCache().put(stableId, recordId, generation, cost); } @Override - public void put(@Nonnull String key, @Nonnull RecordId value) { + public void put(@NotNull String key, @NotNull RecordId value) { throw new UnsupportedOperationException(); } - @CheckForNull + @Nullable @Override - public RecordId get(@Nonnull String stableId) { + public RecordId get(@NotNull String stableId) { return nodeCache().get(stableId, generation); } }; } - @CheckForNull + @Nullable @Override public CacheStatsMBean getStringCacheStats() { return new RecordCacheStats("String deduplication cache stats", @@ -347,7 +345,7 @@ public abstract class WriterCacheManager accumulateRecordCacheWeights(stringCaches)); } - @CheckForNull + @Nullable @Override public CacheStatsMBean getTemplateCacheStats() { return new RecordCacheStats("Template deduplication cache stats", @@ -356,7 +354,7 @@ public abstract class WriterCacheManager accumulateRecordCacheWeights(templateCaches)); } - @Nonnull + @NotNull private static <T> Supplier<CacheStats> accumulateRecordCacheStats( final Iterable<RecordCache<T>> caches) { return new Supplier<CacheStats>() { @@ -371,7 +369,7 @@ public abstract class WriterCacheManager }; } - @Nonnull + @NotNull public static <T> Supplier<Long> accumulateRecordCacheSizes( final Iterable<RecordCache<T>> caches) { return new Supplier<Long>() { @@ -386,7 +384,7 @@ public abstract class WriterCacheManager }; } - @Nonnull + @NotNull public static <T> Supplier<Long> accumulateRecordCacheWeights( final Iterable<RecordCache<T>> caches) { return new Supplier<Long>() { @@ -401,7 +399,7 @@ public abstract class WriterCacheManager }; } - @CheckForNull + @Nullable @Override public CacheStatsMBean getNodeCacheStats() { return new RecordCacheStats("Node deduplication cache stats", @@ -442,13 +440,13 @@ public abstract class WriterCacheManager * into a {@link CacheAccessTracker}. */ private static class AccessTrackingCacheManager extends WriterCacheManager { - @Nonnull + @NotNull private final String name; - @Nonnull + @NotNull private final StatisticsProvider statisticsProvider; - @Nonnull + @NotNull private final WriterCacheManager delegate; /** @@ -463,9 +461,9 @@ public abstract class WriterCacheManager * @see #getNodeCache(int) */ public AccessTrackingCacheManager( - @Nonnull String name, - @Nonnull StatisticsProvider statisticsProvider, - @Nonnull WriterCacheManager delegate) { + @NotNull String name, + @NotNull StatisticsProvider statisticsProvider, + @NotNull WriterCacheManager delegate) { this.name = name; this.statisticsProvider = statisticsProvider; this.delegate = delegate; @@ -476,7 +474,7 @@ public abstract class WriterCacheManager * the same name exposing access statistics under * {@code "oak.segment.string-deduplication-cache-" + name} */ - @Nonnull + @NotNull @Override public Cache<String, RecordId> getStringCache(int generation) { return new CacheAccessTracker<>( @@ -490,7 +488,7 @@ public abstract class WriterCacheManager * the same name exposing access statistics under * {@code "oak.segment.template-deduplication-cache-" + name} */ - @Nonnull + @NotNull @Override public Cache<Template, RecordId> getTemplateCache(int generation) { return new CacheAccessTracker<>( @@ -504,7 +502,7 @@ public abstract class WriterCacheManager * the same name exposing access statistics under * {@code "oak.segment.node-deduplication-cache-" + name} */ - @Nonnull + @NotNull @Override public Cache<String, RecordId> getNodeCache(int generation) { return new CacheAccessTracker<>( Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/compaction/SegmentGCOptions.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/compaction/SegmentGCOptions.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/compaction/SegmentGCOptions.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/compaction/SegmentGCOptions.java Wed Nov 7 14:34:38 2018 @@ -19,7 +19,7 @@ package org.apache.jackrabbit.oak.segment.compaction; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * This class holds configuration options for segment store revision gc. @@ -96,7 +96,7 @@ public class SegmentGCOptions { private int retainedGenerations = RETAINED_GENERATIONS_DEFAULT; - @Nonnull + @NotNull private GCType gcType = GCType.FULL; private boolean offline = false; @@ -217,7 +217,7 @@ public class SegmentGCOptions { /** * @return the currently set gc type. */ - @Nonnull + @NotNull public GCType getGCType() { return gcType; } @@ -226,7 +226,7 @@ public class SegmentGCOptions { * Set the gc type. * @param gcType the type of gc to run. */ - public void setGCType(@Nonnull GCType gcType) { + public void setGCType(@NotNull GCType gcType) { this.gcType = gcType; } Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/compaction/SegmentRevisionGC.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/compaction/SegmentRevisionGC.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/compaction/SegmentRevisionGC.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/compaction/SegmentRevisionGC.java Wed Nov 7 14:34:38 2018 @@ -19,10 +19,9 @@ package org.apache.jackrabbit.oak.segment.compaction; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; - import org.apache.jackrabbit.oak.spi.gc.GCMonitor; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * This MBean exposes the settings from {@link SegmentGCOptions} and @@ -141,19 +140,19 @@ public interface SegmentRevisionGC { /** * @return last error or {@code null} if none. */ - @CheckForNull + @Nullable String getLastError(); /** * @return last log message or {@code null} if none. */ - @Nonnull + @NotNull String getLastLogMessage(); /** * @return current status. */ - @Nonnull + @NotNull String getStatus(); /** Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/compaction/SegmentRevisionGCMBean.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/compaction/SegmentRevisionGCMBean.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/compaction/SegmentRevisionGCMBean.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/compaction/SegmentRevisionGCMBean.java Wed Nov 7 14:34:38 2018 @@ -22,13 +22,12 @@ package org.apache.jackrabbit.oak.segmen import static com.google.common.base.Preconditions.checkNotNull; import static org.apache.jackrabbit.oak.segment.compaction.SegmentGCOptions.RETAINED_GENERATIONS_DEFAULT; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; - import org.apache.jackrabbit.oak.commons.jmx.AnnotatedStandardMBean; import org.apache.jackrabbit.oak.segment.compaction.SegmentGCOptions.GCType; import org.apache.jackrabbit.oak.segment.file.FileStore; import org.apache.jackrabbit.oak.segment.file.FileStoreGCMonitor; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,19 +37,19 @@ public class SegmentRevisionGCMBean private static final Logger log = LoggerFactory.getLogger(SegmentRevisionGCMBean.class); - @Nonnull + @NotNull private final FileStore fileStore; - @Nonnull + @NotNull private final SegmentGCOptions gcOptions; - @Nonnull + @NotNull private final FileStoreGCMonitor fileStoreGCMonitor; public SegmentRevisionGCMBean( - @Nonnull FileStore fileStore, - @Nonnull SegmentGCOptions gcOptions, - @Nonnull FileStoreGCMonitor fileStoreGCMonitor) { + @NotNull FileStore fileStore, + @NotNull SegmentGCOptions gcOptions, + @NotNull FileStoreGCMonitor fileStoreGCMonitor) { super(SegmentRevisionGC.class); this.fileStore = checkNotNull(fileStore); this.gcOptions = checkNotNull(gcOptions); @@ -166,19 +165,19 @@ public class SegmentRevisionGCMBean return fileStoreGCMonitor.getLastReclaimedSize(); } - @CheckForNull + @Nullable @Override public String getLastError() { return fileStoreGCMonitor.getLastError(); } - @Nonnull + @NotNull @Override public String getLastLogMessage() { return fileStoreGCMonitor.getLastLogMessage(); } - @Nonnull + @NotNull @Override public String getStatus() { return fileStoreGCMonitor.getStatus(); Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/AbstractFileStore.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/AbstractFileStore.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/AbstractFileStore.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/AbstractFileStore.java Wed Nov 7 14:34:38 2018 @@ -29,9 +29,6 @@ import java.util.HashSet; import java.util.Set; import java.util.UUID; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; - import org.apache.commons.io.FileUtils; import org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean; import org.apache.jackrabbit.oak.segment.CachingSegmentReader; @@ -56,6 +53,8 @@ import org.apache.jackrabbit.oak.segment import org.apache.jackrabbit.oak.segment.file.tar.TarFiles; import org.apache.jackrabbit.oak.segment.file.tar.TarRecovery; import org.apache.jackrabbit.oak.spi.blob.BlobStore; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -102,10 +101,10 @@ public abstract class AbstractFileStore return !entries.isEmpty(); } - @Nonnull + @NotNull final SegmentTracker tracker; - @Nonnull + @NotNull final CachingSegmentReader segmentReader; final File directory; @@ -114,7 +113,7 @@ public abstract class AbstractFileStore final boolean memoryMapping; - @Nonnull + @NotNull final SegmentCache segmentCache; final TarRecovery recovery = new TarRecovery() { @@ -131,7 +130,7 @@ public abstract class AbstractFileStore AbstractFileStore(final FileStoreBuilder builder) { this.directory = builder.getDirectory(); this.tracker = new SegmentTracker(new SegmentIdFactory() { - @Override @Nonnull + @Override @NotNull public SegmentId newSegmentId(long msb, long lsb) { return new SegmentId(AbstractFileStore.this, msb, lsb, segmentCache::recordHit); } @@ -150,30 +149,30 @@ public abstract class AbstractFileStore return new SegmentNotFoundException(id, e); } - @Nonnull + @NotNull public CacheStatsMBean getSegmentCacheStats() { return segmentCache.getCacheStats(); } - @Nonnull + @NotNull public CacheStatsMBean getStringCacheStats() { return segmentReader.getStringCacheStats(); } - @Nonnull + @NotNull public CacheStatsMBean getTemplateCacheStats() { return segmentReader.getTemplateCacheStats(); } - @Nonnull + @NotNull public abstract SegmentWriter getWriter(); - @Nonnull + @NotNull public SegmentReader getReader() { return segmentReader; } - @Nonnull + @NotNull public SegmentIdProvider getSegmentIdProvider() { return tracker; } @@ -191,7 +190,7 @@ public abstract class AbstractFileStore * </pre> * @return the current head node state */ - @Nonnull + @NotNull public SegmentNodeState getHead() { return segmentReader.readHeadState(getRevisions()); } @@ -199,7 +198,7 @@ public abstract class AbstractFileStore /** * @return the external BlobStore (if configured) with this store, {@code null} otherwise. */ - @CheckForNull + @Nullable public BlobStore getBlobStore() { return blobStore; } Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java Wed Nov 7 14:34:38 2018 @@ -60,10 +60,6 @@ import java.util.concurrent.atomic.Atomi import java.util.concurrent.atomic.AtomicLong; import java.util.function.Consumer; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import com.google.common.base.Function; import com.google.common.base.Joiner; import com.google.common.base.Predicate; @@ -91,6 +87,8 @@ import org.apache.jackrabbit.oak.spi.sta import org.apache.jackrabbit.oak.spi.state.NodeState; import org.apache.jackrabbit.oak.stats.TimerStats; import org.apache.jackrabbit.oak.stats.TimerStats.Context; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -117,17 +115,17 @@ public class FileStore extends AbstractF */ private static final AtomicLong GC_COUNT = new AtomicLong(0); - @Nonnull + @NotNull private final SegmentWriter segmentWriter; - @Nonnull + @NotNull private final GarbageCollector garbageCollector; private final TarFiles tarFiles; private final RandomAccessFile lockFile; - @Nonnull + @NotNull private final FileLock lock; private volatile TarRevisions revisions; @@ -160,7 +158,7 @@ public class FileStore extends AbstractF private final ShutDown shutDown = new ShutDown(); - @Nonnull + @NotNull private final SegmentNotFoundExceptionListener snfeListener; FileStore(final FileStoreBuilder builder) throws InvalidFileStoreVersionException, IOException { @@ -242,7 +240,7 @@ public class FileStore extends AbstractF } } - @Nonnull + @NotNull private Supplier<RecordId> initialNode() { return new Supplier<RecordId>() { @Override @@ -263,7 +261,7 @@ public class FileStore extends AbstractF }; } - @Nonnull + @NotNull private GCGeneration getGcGeneration() { return revisions.getHead().getSegmentId().getGcGeneration(); } @@ -429,7 +427,7 @@ public class FileStore extends AbstractF } @Override - @Nonnull + @NotNull public SegmentWriter getWriter() { try (ShutDownCloser ignored = shutDown.keepAlive()) { return segmentWriter; @@ -437,7 +435,7 @@ public class FileStore extends AbstractF } @Override - @Nonnull + @NotNull public TarRevisions getRevisions() { try (ShutDownCloser ignored = shutDown.keepAlive()) { return revisions; @@ -481,7 +479,7 @@ public class FileStore extends AbstractF } @Override - @Nonnull + @NotNull public Segment readSegment(final SegmentId id) { try (ShutDownCloser ignored = shutDown.keepAlive()) { return segmentCache.getSegment(id, () -> readSegmentUncached(tarFiles, id)); @@ -560,22 +558,22 @@ public class FileStore extends AbstractF private class GarbageCollector { - @Nonnull + @NotNull private final SegmentGCOptions gcOptions; /** * {@code GcListener} listening to this instance's gc progress */ - @Nonnull + @NotNull private final PrefixedGCListener gcListener; - @Nonnull + @NotNull private final GCJournal gcJournal; - @Nonnull + @NotNull private final WriterCacheManager cacheManager; - @Nonnull + @NotNull private GCNodeWriteMonitor compactionMonitor = GCNodeWriteMonitor.EMPTY; private volatile boolean cancelled; @@ -592,14 +590,14 @@ public class FileStore extends AbstractF * conservative and safe in case it does not match the real type (e.g. because * of a system restart). */ - @Nonnull + @NotNull private GCType lastCompactionType = FULL; GarbageCollector( - @Nonnull SegmentGCOptions gcOptions, - @Nonnull GCListener gcListener, - @Nonnull GCJournal gcJournal, - @Nonnull WriterCacheManager cacheManager) { + @NotNull SegmentGCOptions gcOptions, + @NotNull GCListener gcListener, + @NotNull GCJournal gcJournal, + @NotNull WriterCacheManager cacheManager) { this.gcOptions = gcOptions; this.gcListener = new PrefixedGCListener(gcListener, GC_COUNT); this.gcJournal = gcJournal; @@ -696,22 +694,22 @@ public class FileStore extends AbstractF return new SizeDeltaGcEstimation(gcOptions.getGcSizeDeltaEstimation(), gcJournal, tarFiles.size(), full).estimate(); } - @Nonnull - private CompactionResult compactionAborted(@Nonnull GCGeneration generation) { + @NotNull + private CompactionResult compactionAborted(@NotNull GCGeneration generation) { gcListener.compactionFailed(generation); return CompactionResult.aborted(getGcGeneration(), generation); } - @Nonnull + @NotNull private CompactionResult compactionSucceeded( - @Nonnull GCType gcType, - @Nonnull GCGeneration generation, - @Nonnull RecordId compactedRootId) { + @NotNull GCType gcType, + @NotNull GCGeneration generation, + @NotNull RecordId compactedRootId) { gcListener.compactionSucceeded(generation); return CompactionResult.succeeded(gcType, generation, gcOptions, compactedRootId); } - @CheckForNull + @Nullable private SegmentNodeState getBase() { String root = gcJournal.read().getRoot(); RecordId rootId = RecordId.fromString(tracker, root); @@ -744,9 +742,9 @@ public class FileStore extends AbstractF } private CompactionResult compact( - @Nonnull GCType gcType, - @Nonnull NodeState base, - @Nonnull GCGeneration newGeneration) { + @NotNull GCType gcType, + @NotNull NodeState base, + @NotNull GCGeneration newGeneration) { try { PrintableStopwatch watch = PrintableStopwatch.createStarted(); gcListener.info("compaction started, gc options={}, current generation={}, new generation={}", @@ -861,9 +859,9 @@ public class FileStore extends AbstractF } private SegmentNodeState forceCompact( - @Nonnull final NodeState base, - @Nonnull final NodeState onto, - @Nonnull final CheckpointCompactor compactor) + @NotNull final NodeState base, + @NotNull final NodeState onto, + @NotNull final CheckpointCompactor compactor) throws InterruptedException { RecordId compactedId = revisions.setHead(new Function<RecordId, RecordId>() { @Nullable @@ -932,7 +930,7 @@ public class FileStore extends AbstractF * @return list of files to be removed * @throws IOException */ - @Nonnull + @NotNull synchronized List<File> cleanup() throws IOException { return cleanup(CompactionResult.skipped( lastCompactionType, @@ -947,8 +945,8 @@ public class FileStore extends AbstractF * @return list of files to be removed * @throws IOException */ - @Nonnull - private List<File> cleanup(@Nonnull CompactionResult compactionResult) + @NotNull + private List<File> cleanup(@NotNull CompactionResult compactionResult) throws IOException { PrintableStopwatch watch = PrintableStopwatch.createStarted(); @@ -982,7 +980,7 @@ public class FileStore extends AbstractF return cleanupResult.getRemovableFiles(); } - private String toFileNames(@Nonnull List<File> files) { + private String toFileNames(@NotNull List<File> files) { if (files.isEmpty()) { return "none"; } else { @@ -1028,7 +1026,7 @@ public class FileStore extends AbstractF private volatile long baseLine; private volatile long deadline; - public CancelCompactionSupplier(@Nonnull FileStore store) { + public CancelCompactionSupplier(@NotNull FileStore store) { cancelled = false; this.store = store; } @@ -1038,7 +1036,7 @@ public class FileStore extends AbstractF * a previous one that did not yet elapse. Setting a timeout after * cancellation took place has no effect. */ - public void timeOutAfter(final long duration, @Nonnull final TimeUnit unit) { + public void timeOutAfter(final long duration, @NotNull final TimeUnit unit) { baseLine = currentTimeMillis(); deadline = baseLine + MILLISECONDS.convert(duration, unit); } @@ -1084,10 +1082,10 @@ public class FileStore extends AbstractF * #skipped(GCType, GCGeneration, SegmentGCOptions, RecordId)} skipped}. */ private abstract static class CompactionResult { - @Nonnull + @NotNull private final GCGeneration currentGeneration; - protected CompactionResult(@Nonnull GCGeneration currentGeneration) { + protected CompactionResult(@NotNull GCGeneration currentGeneration) { this.currentGeneration = currentGeneration; } @@ -1099,10 +1097,10 @@ public class FileStore extends AbstractF * @param compactedRootId the record id of the root created by compaction */ static CompactionResult succeeded( - @Nonnull GCType gcType, - @Nonnull GCGeneration newGeneration, - @Nonnull final SegmentGCOptions gcOptions, - @Nonnull final RecordId compactedRootId) { + @NotNull GCType gcType, + @NotNull GCGeneration newGeneration, + @NotNull final SegmentGCOptions gcOptions, + @NotNull final RecordId compactedRootId) { return new CompactionResult(newGeneration) { @Override Predicate<GCGeneration> reclaimer() { @@ -1127,8 +1125,8 @@ public class FileStore extends AbstractF * @param failedGeneration the generation that compaction attempted to create */ static CompactionResult aborted( - @Nonnull GCGeneration currentGeneration, - @Nonnull final GCGeneration failedGeneration) { + @NotNull GCGeneration currentGeneration, + @NotNull final GCGeneration failedGeneration) { return new CompactionResult(currentGeneration) { @Override Predicate<GCGeneration> reclaimer() { @@ -1149,10 +1147,10 @@ public class FileStore extends AbstractF * @param gcOptions the current GC options used by compaction */ static CompactionResult skipped( - @Nonnull GCType lastGCType, - @Nonnull GCGeneration currentGeneration, - @Nonnull final SegmentGCOptions gcOptions, - @Nonnull final RecordId compactedRootId) { + @NotNull GCType lastGCType, + @NotNull GCGeneration currentGeneration, + @NotNull final SegmentGCOptions gcOptions, + @NotNull final RecordId compactedRootId) { return new CompactionResult(currentGeneration) { @Override Predicate<GCGeneration> reclaimer() { Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStoreBuilder.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStoreBuilder.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStoreBuilder.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStoreBuilder.java Wed Nov 7 14:34:38 2018 @@ -33,9 +33,6 @@ import static org.apache.jackrabbit.oak. import java.io.File; import java.io.IOException; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; - import com.google.common.base.Predicate; import org.apache.jackrabbit.oak.segment.CacheWeights.NodeCacheWeigher; import org.apache.jackrabbit.oak.segment.CacheWeights.StringCacheWeigher; @@ -52,6 +49,8 @@ import org.apache.jackrabbit.oak.spi.gc. import org.apache.jackrabbit.oak.spi.gc.GCMonitor; import org.apache.jackrabbit.oak.spi.gc.LoggingGCMonitor; import org.apache.jackrabbit.oak.stats.StatisticsProvider; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -66,10 +65,10 @@ public class FileStoreBuilder { public static final int DEFAULT_MAX_FILE_SIZE = 256; - @Nonnull + @NotNull private final File directory; - @CheckForNull + @Nullable private BlobStore blobStore; // null -> store blobs inline private int maxFileSize = DEFAULT_MAX_FILE_SIZE; @@ -88,18 +87,18 @@ public class FileStoreBuilder { private boolean memoryMapping = MEMORY_MAPPING_DEFAULT; - @Nonnull + @NotNull private StatisticsProvider statsProvider = StatisticsProvider.NOOP; - @Nonnull + @NotNull private SegmentGCOptions gcOptions = defaultGCOptions(); - @CheckForNull + @Nullable private EvictingWriteCacheManager cacheManager; private class FileStoreGCListener extends DelegatingGCMonitor implements GCListener { @Override - public void compactionSucceeded(@Nonnull GCGeneration newGeneration) { + public void compactionSucceeded(@NotNull GCGeneration newGeneration) { compacted(); if (cacheManager != null) { cacheManager.evictOldGeneration(newGeneration.getGeneration()); @@ -107,17 +106,17 @@ public class FileStoreBuilder { } @Override - public void compactionFailed(@Nonnull GCGeneration failedGeneration) { + public void compactionFailed(@NotNull GCGeneration failedGeneration) { if (cacheManager != null) { cacheManager.evictGeneration(failedGeneration.getGeneration()); } } } - @Nonnull + @NotNull private final FileStoreGCListener gcListener = new FileStoreGCListener(); - @Nonnull + @NotNull private SegmentNotFoundExceptionListener snfeListener = LOG_SNFE; private IOMonitor ioMonitor = new IOMonitorAdapter(); @@ -131,12 +130,12 @@ public class FileStoreBuilder { * @param directory directory where the tar files are stored * @return a new {@code FileStoreBuilder} instance. */ - @Nonnull - public static FileStoreBuilder fileStoreBuilder(@Nonnull File directory) { + @NotNull + public static FileStoreBuilder fileStoreBuilder(@NotNull File directory) { return new FileStoreBuilder(directory); } - private FileStoreBuilder(@Nonnull File directory) { + private FileStoreBuilder(@NotNull File directory) { this.directory = checkNotNull(directory); this.gcListener.registerGCMonitor(new LoggingGCMonitor(LOG)); } @@ -146,8 +145,8 @@ public class FileStoreBuilder { * @param blobStore * @return this instance */ - @Nonnull - public FileStoreBuilder withBlobStore(@Nonnull BlobStore blobStore) { + @NotNull + public FileStoreBuilder withBlobStore(@NotNull BlobStore blobStore) { this.blobStore = checkNotNull(blobStore); return this; } @@ -157,7 +156,7 @@ public class FileStoreBuilder { * @param maxFileSize * @return this instance */ - @Nonnull + @NotNull public FileStoreBuilder withMaxFileSize(int maxFileSize) { this.maxFileSize = maxFileSize; return this; @@ -168,7 +167,7 @@ public class FileStoreBuilder { * @param segmentCacheSize None negative cache size * @return this instance */ - @Nonnull + @NotNull public FileStoreBuilder withSegmentCacheSize(int segmentCacheSize) { this.segmentCacheSize = segmentCacheSize; return this; @@ -179,7 +178,7 @@ public class FileStoreBuilder { * @param stringCacheSize None negative cache size * @return this instance */ - @Nonnull + @NotNull public FileStoreBuilder withStringCacheSize(int stringCacheSize) { this.stringCacheSize = stringCacheSize; return this; @@ -190,7 +189,7 @@ public class FileStoreBuilder { * @param templateCacheSize None negative cache size * @return this instance */ - @Nonnull + @NotNull public FileStoreBuilder withTemplateCacheSize(int templateCacheSize) { this.templateCacheSize = templateCacheSize; return this; @@ -201,7 +200,7 @@ public class FileStoreBuilder { * @param stringDeduplicationCacheSize None negative cache size * @return this instance */ - @Nonnull + @NotNull public FileStoreBuilder withStringDeduplicationCacheSize(int stringDeduplicationCacheSize) { this.stringDeduplicationCacheSize = stringDeduplicationCacheSize; return this; @@ -212,7 +211,7 @@ public class FileStoreBuilder { * @param templateDeduplicationCacheSize None negative cache size * @return this instance */ - @Nonnull + @NotNull public FileStoreBuilder withTemplateDeduplicationCacheSize(int templateDeduplicationCacheSize) { this.templateDeduplicationCacheSize = templateDeduplicationCacheSize; return this; @@ -223,7 +222,7 @@ public class FileStoreBuilder { * @param nodeDeduplicationCacheSize None negative cache size. Must be a power of 2. * @return this instance */ - @Nonnull + @NotNull public FileStoreBuilder withNodeDeduplicationCacheSize(int nodeDeduplicationCacheSize) { this.nodeDeduplicationCacheSize = nodeDeduplicationCacheSize; return this; @@ -234,7 +233,7 @@ public class FileStoreBuilder { * @param memoryMapping * @return this instance */ - @Nonnull + @NotNull public FileStoreBuilder withMemoryMapping(boolean memoryMapping) { this.memoryMapping = memoryMapping; return this; @@ -244,7 +243,7 @@ public class FileStoreBuilder { * Set memory mapping to the default value based on OS properties * @return this instance */ - @Nonnull + @NotNull public FileStoreBuilder withDefaultMemoryMapping() { this.memoryMapping = MEMORY_MAPPING_DEFAULT; return this; @@ -255,8 +254,8 @@ public class FileStoreBuilder { * @param gcMonitor * @return this instance */ - @Nonnull - public FileStoreBuilder withGCMonitor(@Nonnull GCMonitor gcMonitor) { + @NotNull + public FileStoreBuilder withGCMonitor(@NotNull GCMonitor gcMonitor) { this.gcListener.registerGCMonitor(checkNotNull(gcMonitor)); return this; } @@ -266,8 +265,8 @@ public class FileStoreBuilder { * @param statisticsProvider * @return this instance */ - @Nonnull - public FileStoreBuilder withStatisticsProvider(@Nonnull StatisticsProvider statisticsProvider) { + @NotNull + public FileStoreBuilder withStatisticsProvider(@NotNull StatisticsProvider statisticsProvider) { this.statsProvider = checkNotNull(statisticsProvider); return this; } @@ -277,7 +276,7 @@ public class FileStoreBuilder { * @param gcOptions * @return this instance */ - @Nonnull + @NotNull public FileStoreBuilder withGCOptions(SegmentGCOptions gcOptions) { this.gcOptions = checkNotNull(gcOptions); return this; @@ -288,13 +287,13 @@ public class FileStoreBuilder { * @param snfeListener, the actual listener * @return this instance */ - @Nonnull - public FileStoreBuilder withSnfeListener(@Nonnull SegmentNotFoundExceptionListener snfeListener) { + @NotNull + public FileStoreBuilder withSnfeListener(@NotNull SegmentNotFoundExceptionListener snfeListener) { this.snfeListener = checkNotNull(snfeListener); return this; } - @Nonnull + @NotNull public FileStoreBuilder withIOMonitor(IOMonitor ioMonitor) { this.ioMonitor = checkNotNull(ioMonitor); return this; @@ -308,7 +307,7 @@ public class FileStoreBuilder { * @param strictVersionCheck enables strict version checking iff {@code true}. * @return this instance */ - @Nonnull + @NotNull public FileStoreBuilder withStrictVersionCheck(boolean strictVersionCheck) { this.strictVersionCheck = strictVersionCheck; return this; @@ -331,7 +330,7 @@ public class FileStoreBuilder { * @return a new file store instance * @throws IOException */ - @Nonnull + @NotNull public FileStore build() throws InvalidFileStoreVersionException, IOException { checkState(!built, "Cannot re-use builder"); built = true; @@ -370,7 +369,7 @@ public class FileStoreBuilder { * @return a new file store instance * @throws IOException */ - @Nonnull + @NotNull public ReadOnlyFileStore buildReadOnly() throws InvalidFileStoreVersionException, IOException { checkState(!built, "Cannot re-use builder"); checkState(directory.exists() && directory.isDirectory(), @@ -393,12 +392,12 @@ public class FileStoreBuilder { return store; } - @Nonnull + @NotNull File getDirectory() { return directory; } - @CheckForNull + @Nullable BlobStore getBlobStore() { return blobStore; } @@ -423,22 +422,22 @@ public class FileStoreBuilder { return memoryMapping; } - @Nonnull + @NotNull GCListener getGcListener() { return gcListener; } - @Nonnull + @NotNull StatisticsProvider getStatsProvider() { return statsProvider; } - @Nonnull + @NotNull SegmentGCOptions getGcOptions() { return gcOptions; } - @Nonnull + @NotNull SegmentNotFoundExceptionListener getSnfeListener() { return snfeListener; } @@ -451,7 +450,7 @@ public class FileStoreBuilder { * @see #withStringDeduplicationCacheSize(int) * @see #withTemplateDeduplicationCacheSize(int) */ - @Nonnull + @NotNull public WriterCacheManager getCacheManager() { if (cacheManager == null) { cacheManager = new EvictingWriteCacheManager(stringDeduplicationCacheSize, Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStoreGCMonitor.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStoreGCMonitor.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStoreGCMonitor.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStoreGCMonitor.java Wed Nov 7 14:34:38 2018 @@ -25,11 +25,10 @@ import static org.slf4j.helpers.MessageF import java.io.PrintWriter; import java.io.StringWriter; -import javax.annotation.Nonnull; - import org.apache.jackrabbit.oak.segment.compaction.SegmentGCStatus; import org.apache.jackrabbit.oak.spi.gc.GCMonitor; import org.apache.jackrabbit.oak.stats.Clock; +import org.jetbrains.annotations.NotNull; /** * {@link GCMonitor} implementation providing the file store gc status. @@ -45,7 +44,7 @@ public class FileStoreGCMonitor implemen private String lastLogMessage; private String status = SegmentGCStatus.IDLE.message(); - public FileStoreGCMonitor(@Nonnull Clock clock) { + public FileStoreGCMonitor(@NotNull Clock clock) { this.clock = checkNotNull(clock); } @@ -111,12 +110,12 @@ public class FileStoreGCMonitor implemen return lastError; } - @Nonnull + @NotNull public String getLastLogMessage() { return lastLogMessage; } - @Nonnull + @NotNull public String getStatus() { return status; } Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStoreStats.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStoreStats.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStoreStats.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStoreStats.java Wed Nov 7 14:34:38 2018 @@ -21,7 +21,6 @@ package org.apache.jackrabbit.oak.segmen import static org.apache.jackrabbit.stats.TimeSeriesStatsUtil.asCompositeData; -import javax.annotation.Nonnull; import javax.management.openmbean.CompositeData; import org.apache.jackrabbit.api.stats.TimeSeries; @@ -31,6 +30,7 @@ import org.apache.jackrabbit.oak.stats.C import org.apache.jackrabbit.oak.stats.MeterStats; import org.apache.jackrabbit.oak.stats.StatisticsProvider; import org.apache.jackrabbit.oak.stats.StatsOptions; +import org.jetbrains.annotations.NotNull; public class FileStoreStats implements FileStoreStatsMBean, FileStoreMonitor { public static final String SEGMENT_REPO_SIZE = "SEGMENT_REPO_SIZE"; @@ -86,13 +86,13 @@ public class FileStoreStats implements F return store.readerCount() + 1; //1 for the writer } - @Nonnull + @NotNull @Override public CompositeData getWriteStats() { return asCompositeData(getTimeSeries(SEGMENT_WRITES), SEGMENT_WRITES); } - @Nonnull + @NotNull @Override public CompositeData getRepositorySize() { return asCompositeData(getTimeSeries(SEGMENT_REPO_SIZE), SEGMENT_REPO_SIZE); Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCJournal.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCJournal.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCJournal.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCJournal.java Wed Nov 7 14:34:38 2018 @@ -37,12 +37,11 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; - import com.google.common.base.Joiner; import org.apache.jackrabbit.oak.segment.RecordId; import org.apache.jackrabbit.oak.segment.file.tar.GCGeneration; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,12 +57,12 @@ public class GCJournal { public static final String GC_JOURNAL = "gc.log"; - @Nonnull + @NotNull private final File directory; private GCJournalEntry latest; - public GCJournal(@Nonnull File directory) { + public GCJournal(@NotNull File directory) { this.directory = checkNotNull(directory); } @@ -80,7 +79,7 @@ public class GCJournal { * @param root record id of the compacted root node */ public synchronized void persist(long reclaimedSize, long repoSize, - @Nonnull GCGeneration gcGeneration, long nodes, @Nonnull String root + @NotNull GCGeneration gcGeneration, long nodes, @NotNull String root ) { GCJournalEntry current = read(); if (current.getGcGeneration().equals(gcGeneration)) { @@ -152,16 +151,16 @@ public class GCJournal { private final long ts; - @Nonnull + @NotNull private final GCGeneration gcGeneration; private final long nodes; - @Nonnull + @NotNull private final String root; public GCJournalEntry(long repoSize, long reclaimedSize, long ts, - @Nonnull GCGeneration gcGeneration, long nodes, @Nonnull String root + @NotNull GCGeneration gcGeneration, long nodes, @NotNull String root ) { this.repoSize = repoSize; this.reclaimedSize = reclaimedSize; @@ -209,7 +208,7 @@ public class GCJournal { newGCGeneration(generation, fullGeneration, false), nodes, root); } - @CheckForNull + @Nullable private static String parseString(String[] items, int index) { if (index >= items.length) { return null; @@ -265,7 +264,7 @@ public class GCJournal { /** * Returns the gc generation */ - @Nonnull + @NotNull public GCGeneration getGcGeneration() { return gcGeneration; } @@ -280,7 +279,7 @@ public class GCJournal { /** * Returns the record id of the root created by the compactor */ - @Nonnull + @NotNull public String getRoot() { return root; } Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCListener.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCListener.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCListener.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCListener.java Wed Nov 7 14:34:38 2018 @@ -19,10 +19,9 @@ package org.apache.jackrabbit.oak.segment.file; -import javax.annotation.Nonnull; - import org.apache.jackrabbit.oak.segment.file.tar.GCGeneration; import org.apache.jackrabbit.oak.spi.gc.GCMonitor; +import org.jetbrains.annotations.NotNull; /** * Listener receiving notifications about the garbage collection process @@ -34,12 +33,12 @@ interface GCListener extends GCMonitor { * a new generation of segments * @param newGeneration the new generation number */ - void compactionSucceeded(@Nonnull GCGeneration newGeneration); + void compactionSucceeded(@NotNull GCGeneration newGeneration); /** * Notification of a failed compaction. A new generation of * segments could not be created. * @param failedGeneration the generation number that could not be created */ - void compactionFailed(@Nonnull GCGeneration failedGeneration); + void compactionFailed(@NotNull GCGeneration failedGeneration); } Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCMemoryBarrier.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCMemoryBarrier.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCMemoryBarrier.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCMemoryBarrier.java Wed Nov 7 14:34:38 2018 @@ -30,7 +30,6 @@ import java.lang.management.MemoryPoolMX import java.lang.management.MemoryUsage; import java.util.concurrent.atomic.AtomicBoolean; -import javax.annotation.Nonnull; import javax.management.ListenerNotFoundException; import javax.management.Notification; import javax.management.NotificationEmitter; @@ -38,6 +37,7 @@ import javax.management.NotificationList import javax.management.openmbean.CompositeData; import org.apache.jackrabbit.oak.segment.compaction.SegmentGCOptions; +import org.jetbrains.annotations.NotNull; /** * Responsible for raising the low memory flag whenever the available memory @@ -49,21 +49,21 @@ public class GCMemoryBarrier implements // TODO possibly add a min value to the percentage, ie. skip gc if available // heap drops under 2GB - @Nonnull + @NotNull private final AtomicBoolean sufficientMemory; - @Nonnull + @NotNull private final GCListener gcListener; - @Nonnull + @NotNull private final SegmentGCOptions gcOptions; private final NotificationEmitter emitter; private final MemoryListener listener; - public GCMemoryBarrier(@Nonnull AtomicBoolean sufficientMemory, - @Nonnull GCListener gcListener, - @Nonnull SegmentGCOptions gcOptions) { + public GCMemoryBarrier(@NotNull AtomicBoolean sufficientMemory, + @NotNull GCListener gcListener, + @NotNull SegmentGCOptions gcOptions) { this.sufficientMemory = sufficientMemory; this.gcListener = gcListener; this.gcOptions = gcOptions; Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCNodeWriteMonitor.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCNodeWriteMonitor.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCNodeWriteMonitor.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/GCNodeWriteMonitor.java Wed Nov 7 14:34:38 2018 @@ -18,9 +18,8 @@ */ package org.apache.jackrabbit.oak.segment.file; -import javax.annotation.Nonnull; - import org.apache.jackrabbit.oak.spi.gc.GCMonitor; +import org.jetbrains.annotations.NotNull; /** * Monitors the compaction cycle and keeps a compacted nodes counter, in order @@ -65,7 +64,7 @@ public class GCNodeWriteMonitor { private boolean running = false; - public GCNodeWriteMonitor(long gcProgressLog, @Nonnull GCMonitor gcMonitor) { + public GCNodeWriteMonitor(long gcProgressLog, @NotNull GCMonitor gcMonitor) { this.gcProgressLog = gcProgressLog; this.gcMonitor = gcMonitor; } @@ -128,7 +127,7 @@ public class GCNodeWriteMonitor { return estimated; } - @Nonnull + @NotNull private String getPercentageDone() { return estimated > 0 ? getEstimatedPercentage() + "% complete." Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/JournalEntry.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/JournalEntry.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/JournalEntry.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/JournalEntry.java Wed Nov 7 14:34:38 2018 @@ -19,23 +19,23 @@ package org.apache.jackrabbit.oak.segment.file; -import javax.annotation.Nonnull; +import org.jetbrains.annotations.NotNull; /** * A value class representing an entry in the revisions journal. */ public class JournalEntry { - @Nonnull + @NotNull private final String revision; private final long timestamp; - JournalEntry(@Nonnull String revision, long timestamp) { + JournalEntry(@NotNull String revision, long timestamp) { this.revision = revision; this.timestamp = timestamp; } - @Nonnull + @NotNull public String getRevision() { return revision; } Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/MetricsIOMonitor.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/MetricsIOMonitor.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/MetricsIOMonitor.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/MetricsIOMonitor.java Wed Nov 7 14:34:38 2018 @@ -22,13 +22,12 @@ import static java.util.concurrent.TimeU import java.io.File; -import javax.annotation.Nonnull; - import org.apache.jackrabbit.oak.segment.file.tar.IOMonitorAdapter; import org.apache.jackrabbit.oak.stats.MeterStats; import org.apache.jackrabbit.oak.stats.StatisticsProvider; import org.apache.jackrabbit.oak.stats.StatsOptions; import org.apache.jackrabbit.oak.stats.TimerStats; +import org.jetbrains.annotations.NotNull; /** * This {@code IOMonitor} implementations registers the following monitoring endpoints @@ -55,7 +54,7 @@ public class MetricsIOMonitor extends IO private final TimerStats segmentReadTime; private final TimerStats segmentWriteTime; - public MetricsIOMonitor(@Nonnull StatisticsProvider statisticsProvider) { + public MetricsIOMonitor(@NotNull StatisticsProvider statisticsProvider) { segmentReadBytes = statisticsProvider.getMeter( OAK_SEGMENT_SEGMENT_READ_BYTES, StatsOptions.METRICS_ONLY); segmentWriteBytes = statisticsProvider.getMeter( Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/PrefixedGCListener.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/PrefixedGCListener.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/PrefixedGCListener.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/PrefixedGCListener.java Wed Nov 7 14:34:38 2018 @@ -20,9 +20,8 @@ package org.apache.jackrabbit.oak.segmen import java.util.concurrent.atomic.AtomicLong; -import javax.annotation.Nonnull; - import org.apache.jackrabbit.oak.segment.file.tar.GCGeneration; +import org.jetbrains.annotations.NotNull; /** * A {@link GCListener} that adds a prefix to every log message and delegates to @@ -45,12 +44,12 @@ class PrefixedGCListener implements GCLi } @Override - public void compactionSucceeded(@Nonnull GCGeneration newGeneration) { + public void compactionSucceeded(@NotNull GCGeneration newGeneration) { listener.compactionSucceeded(newGeneration); } @Override - public void compactionFailed(@Nonnull GCGeneration failedGeneration) { + public void compactionFailed(@NotNull GCGeneration failedGeneration) { listener.compactionFailed(failedGeneration); } Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/PriorityCache.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/PriorityCache.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/PriorityCache.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/PriorityCache.java Wed Nov 7 14:34:38 2018 @@ -27,10 +27,9 @@ import static java.lang.Long.numberOfLea import static java.lang.Math.max; import static java.util.Arrays.fill; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; - import org.apache.jackrabbit.oak.segment.CacheWeights; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import com.google.common.base.Predicate; import com.google.common.base.Supplier; @@ -70,7 +69,7 @@ public class PriorityCache<K, V> { private long evictionCount; private long size; - @Nonnull + @NotNull private final Weigher<K, V> weigher; private long weight = 0; @@ -79,7 +78,7 @@ public class PriorityCache<K, V> { * @param size size of the cache. Must be a power of 2. * @return a new {@code PriorityCache} instance of the given {@code size}. */ - public static <K, V> Supplier<PriorityCache<K, V>> factory(final int size, @Nonnull final Weigher<K, V> weigher) { + public static <K, V> Supplier<PriorityCache<K, V>> factory(final int size, @NotNull final Weigher<K, V> weigher) { checkArgument(bitCount(size) == 1); checkNotNull(weigher); return new Supplier<PriorityCache<K, V>>() { @@ -156,7 +155,7 @@ public class PriorityCache<K, V> { * smaller than {@code 32 - numberOfTrailingZeros(size)}. * @param weigher Needed to provide an estimation of the cache weight in memory */ - public PriorityCache(int size, int rehash, @Nonnull Weigher<K, V> weigher) { + public PriorityCache(int size, int rehash, @NotNull Weigher<K, V> weigher) { checkArgument(bitCount(size) == 1); checkArgument(rehash >= 0); checkArgument(rehash < 32 - numberOfTrailingZeros(size)); @@ -171,7 +170,7 @@ public class PriorityCache<K, V> { * the maximum number allowed by the given {@code size}. ({@code 31 - numberOfTrailingZeros(size)}. * @param size Size of the cache. Must be a power of {@code 2}. */ - public PriorityCache(int size, @Nonnull Weigher<K, V> weigher) { + public PriorityCache(int size, @NotNull Weigher<K, V> weigher) { this(size, 31 - numberOfTrailingZeros(size), weigher); } @@ -198,7 +197,7 @@ public class PriorityCache<K, V> { * @param initialCost the initial cost associated with this mapping * @return {@code true} if the mapping has been added, {@code false} otherwise. */ - public synchronized boolean put(@Nonnull K key, @Nonnull V value, int generation, byte initialCost) { + public synchronized boolean put(@NotNull K key, @NotNull V value, int generation, byte initialCost) { int hashCode = key.hashCode(); byte cheapest = initialCost; int index = -1; @@ -265,8 +264,8 @@ public class PriorityCache<K, V> { * cache does not contain such a mapping. */ @SuppressWarnings("unchecked") - @CheckForNull - public synchronized V get(@Nonnull K key, int generation) { + @Nullable + public synchronized V get(@NotNull K key, int generation) { int hashCode = key.hashCode(); for (int k = 0; k <= rehash; k++) { int i = project(hashCode, k); @@ -290,7 +289,7 @@ public class PriorityCache<K, V> { * passed {@code purge} predicate. * @param purge */ - public synchronized void purgeGenerations(@Nonnull Predicate<Integer> purge) { + public synchronized void purgeGenerations(@NotNull Predicate<Integer> purge) { for (int i = 0; i < entries.length; i++) { Entry<?, ?> entry = entries[i]; if (entry != Entry.NULL && purge.apply(entry.generation)) { @@ -328,7 +327,7 @@ public class PriorityCache<K, V> { /** * @return access statistics for this cache */ - @Nonnull + @NotNull public CacheStats getStats() { return new CacheStats(hitCount, missCount, loadCount, loadExceptionCount, 0, evictionCount); } Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/ReadOnlyFileStore.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/ReadOnlyFileStore.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/ReadOnlyFileStore.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/ReadOnlyFileStore.java Wed Nov 7 14:34:38 2018 @@ -29,14 +29,13 @@ import java.util.UUID; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; -import javax.annotation.Nonnull; - import com.google.common.io.Closer; import org.apache.jackrabbit.oak.segment.RecordId; import org.apache.jackrabbit.oak.segment.Segment; import org.apache.jackrabbit.oak.segment.SegmentId; import org.apache.jackrabbit.oak.segment.SegmentWriter; import org.apache.jackrabbit.oak.segment.file.tar.TarFiles; +import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -53,7 +52,7 @@ public class ReadOnlyFileStore extends A private final TarFiles tarFiles; - @Nonnull + @NotNull private final SegmentWriter writer; private ReadOnlyRevisions revisions; @@ -78,7 +77,7 @@ public class ReadOnlyFileStore extends A memoryMapping); } - ReadOnlyFileStore bind(@Nonnull ReadOnlyRevisions revisions) throws IOException { + ReadOnlyFileStore bind(@NotNull ReadOnlyRevisions revisions) throws IOException { this.revisions = revisions; this.revisions.bind(this, tracker); currentHead = revisions.getHead(); @@ -108,7 +107,7 @@ public class ReadOnlyFileStore extends A } @Override - @Nonnull + @NotNull public Segment readSegment(final SegmentId id) { try { return segmentCache.getSegment(id, new Callable<Segment>() { @@ -132,7 +131,7 @@ public class ReadOnlyFileStore extends A log.info("TarMK closed: {}", directory); } - @Nonnull + @NotNull @Override public SegmentWriter getWriter() { return writer; Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/ReadOnlyRevisions.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/ReadOnlyRevisions.java?rev=1846034&r1=1846033&r2=1846034&view=diff ============================================================================== --- jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/ReadOnlyRevisions.java (original) +++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/ReadOnlyRevisions.java Wed Nov 7 14:34:38 2018 @@ -28,13 +28,12 @@ import java.io.IOException; import java.io.RandomAccessFile; import java.util.concurrent.atomic.AtomicReference; -import javax.annotation.Nonnull; - import com.google.common.base.Function; import org.apache.jackrabbit.oak.segment.RecordId; import org.apache.jackrabbit.oak.segment.Revisions; import org.apache.jackrabbit.oak.segment.SegmentIdProvider; import org.apache.jackrabbit.oak.segment.SegmentStore; +import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,16 +44,16 @@ public class ReadOnlyRevisions implement public static final String JOURNAL_FILE_NAME = "journal.log"; - @Nonnull + @NotNull private final AtomicReference<RecordId> head; - @Nonnull + @NotNull private final File directory; - @Nonnull + @NotNull private final RandomAccessFile journalFile; - public ReadOnlyRevisions(@Nonnull File directory) throws IOException { + public ReadOnlyRevisions(@NotNull File directory) throws IOException { this.directory = checkNotNull(directory); this.journalFile = new RandomAccessFile(new File(directory, JOURNAL_FILE_NAME), "r"); @@ -69,7 +68,7 @@ public class ReadOnlyRevisions implement * @param idProvider {@code SegmentIdProvider} of the {@code store} * @throws IOException */ - synchronized void bind(@Nonnull SegmentStore store, @Nonnull SegmentIdProvider idProvider) + synchronized void bind(@NotNull SegmentStore store, @NotNull SegmentIdProvider idProvider) throws IOException { if (head.get() != null) { return; @@ -85,21 +84,21 @@ public class ReadOnlyRevisions implement checkState(head.get() != null, "Revisions not bound to a store"); } - @Nonnull + @NotNull @Override public RecordId getHead() { checkBound(); return head.get(); } - @Nonnull + @NotNull @Override public RecordId getPersistedHead() { return getHead(); } @Override - public boolean setHead(@Nonnull RecordId expected, @Nonnull RecordId head, @Nonnull Option... options) { + public boolean setHead(@NotNull RecordId expected, @NotNull RecordId head, @NotNull Option... options) { checkBound(); RecordId id = this.head.get(); return id.equals(expected) && this.head.compareAndSet(id, head); @@ -107,8 +106,8 @@ public class ReadOnlyRevisions implement @Override public RecordId setHead( - @Nonnull Function<RecordId, RecordId> newHead, - @Nonnull Option... options) throws InterruptedException { + @NotNull Function<RecordId, RecordId> newHead, + @NotNull Option... options) throws InterruptedException { throw new UnsupportedOperationException("ReadOnly Revisions"); }