You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2018/11/07 14:34:39 UTC
svn commit: r1846034 [2/5] - in /jackrabbit/oak/branches/1.8: ./
oak-segment-tar/
oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/backup/impl/
oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/
oak-segment-tar/src/main/java/org/ap...
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/ReaderCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/ReaderCache.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/ReaderCache.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/ReaderCache.java Wed Nov 7 14:34:38 2018
@@ -24,11 +24,10 @@ import static org.apache.jackrabbit.oak.
import java.util.Arrays;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-
import org.apache.jackrabbit.oak.cache.CacheLIRS;
import org.apache.jackrabbit.oak.cache.CacheStats;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import com.google.common.base.Function;
import com.google.common.cache.Weigher;
@@ -39,22 +38,22 @@ import com.google.common.cache.Weigher;
*/
public abstract class ReaderCache<T> {
- @Nonnull
+ @NotNull
private final Weigher<CacheKey, T> weigher;
- @Nonnull
+ @NotNull
private final String name;
/**
* The fast (array based) cache.
*/
- @CheckForNull
+ @Nullable
private final FastCache<T> fastCache;
/**
* The slower (LIRS) cache.
*/
- @Nonnull
+ @NotNull
private final CacheLIRS<CacheKey, T> cache;
/**
@@ -66,7 +65,7 @@ public abstract class ReaderCache<T> {
* @param weigher Needed to provide an estimation of the cache weight in memory
*/
protected ReaderCache(long maxWeight, int averageWeight,
- @Nonnull String name, @Nonnull Weigher<CacheKey, T> weigher) {
+ @NotNull String name, @NotNull Weigher<CacheKey, T> weigher) {
this.name = checkNotNull(name);
this.weigher = checkNotNull(weigher);
fastCache = new FastCache<>();
@@ -78,7 +77,7 @@ public abstract class ReaderCache<T> {
.build();
}
- @Nonnull
+ @NotNull
public CacheStats getStats() {
return new CacheStats(cache, name, weigher, cache.getMaxMemory());
}
@@ -98,7 +97,7 @@ public abstract class ReaderCache<T> {
* @param loader the loader function
* @return the value
*/
- @Nonnull
+ @NotNull
public T get(long msb, long lsb, int offset, Function<Integer, T> loader) {
int hash = getEntryHash(msb, lsb, offset);
if (fastCache == null) {
@@ -266,4 +265,4 @@ public abstract class ReaderCache<T> {
}
-}
\ No newline at end of file
+}
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Record.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Record.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/Record.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Record.java Wed Nov 7 14:34:38 2018
@@ -18,7 +18,7 @@
*/
package org.apache.jackrabbit.oak.segment;
-import javax.annotation.Nonnull;
+import org.jetbrains.annotations.NotNull;
/**
* Record within a segment.
@@ -29,11 +29,11 @@ class Record {
return a instanceof Record && fastEquals((Record) a, b);
}
- private static boolean fastEquals(@Nonnull Record a, Object b) {
+ private static boolean fastEquals(@NotNull Record a, Object b) {
return b instanceof Record && fastEquals(a, (Record) b);
}
- private static boolean fastEquals(@Nonnull Record a, @Nonnull Record b) {
+ private static boolean fastEquals(@NotNull Record a, @NotNull Record b) {
return a == b || (a.recordNumber == b.recordNumber && a.segmentId.equals(b.segmentId));
}
@@ -52,11 +52,11 @@ class Record {
*
* @param id record identified
*/
- protected Record(@Nonnull RecordId id) {
+ protected Record(@NotNull RecordId id) {
this(id.getSegmentId(), id.getRecordNumber());
}
- protected Record(@Nonnull SegmentId segmentId, int recordNumber) {
+ protected Record(@NotNull SegmentId segmentId, int recordNumber) {
this.segmentId = segmentId;
this.recordNumber = recordNumber;
}
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/RecordCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/RecordCache.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/RecordCache.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/RecordCache.java Wed Nov 7 14:34:38 2018
@@ -24,12 +24,12 @@ import static com.google.common.base.Pre
import java.util.LinkedHashMap;
import java.util.Map;
-import javax.annotation.Nonnull;
-
import com.google.common.base.Supplier;
import com.google.common.cache.CacheStats;
import com.google.common.cache.Weigher;
+import org.jetbrains.annotations.NotNull;
+
/**
* Partial mapping of keys of type {@code K} to values of type {@link RecordId}. This is
* typically used for de-duplicating values that have already been persisted and thus
@@ -50,14 +50,14 @@ public abstract class RecordCache<K> imp
public abstract long estimateCurrentWeight();
@Override
- public void put(@Nonnull K key, @Nonnull RecordId value, byte cost) {
+ public void put(@NotNull K key, @NotNull RecordId value, byte cost) {
throw new UnsupportedOperationException();
}
/**
* @return access statistics for this cache
*/
- @Nonnull
+ @NotNull
public CacheStats getStats() {
return new CacheStats(hitCount, missCount, loadCount, 0, 0, evictionCount);
}
@@ -70,7 +70,7 @@ public abstract class RecordCache<K> imp
*
* @return A new {@code RecordCache} instance of the given {@code size}.
*/
- @Nonnull
+ @NotNull
public static <T> RecordCache<T> newRecordCache(int size) {
if (size <= 0) {
return new Empty<>();
@@ -86,8 +86,8 @@ public abstract class RecordCache<K> imp
* when invoked.
* @see #newRecordCache(int)
*/
- @Nonnull
- public static <T> Supplier<RecordCache<T>> factory(int size, @Nonnull Weigher<T, RecordId> weigher) {
+ @NotNull
+ public static <T> Supplier<RecordCache<T>> factory(int size, @NotNull Weigher<T, RecordId> weigher) {
if (size <= 0) {
return Empty.emptyFactory();
} else {
@@ -101,7 +101,7 @@ public abstract class RecordCache<K> imp
* when invoked.
* @see #newRecordCache(int)
*/
- @Nonnull
+ @NotNull
public static <T> Supplier<RecordCache<T>> factory(int size) {
if (size <= 0) {
return Empty.emptyFactory();
@@ -121,10 +121,10 @@ public abstract class RecordCache<K> imp
}
@Override
- public synchronized void put(@Nonnull T key, @Nonnull RecordId value) { }
+ public synchronized void put(@NotNull T key, @NotNull RecordId value) { }
@Override
- public synchronized RecordId get(@Nonnull T key) {
+ public synchronized RecordId get(@NotNull T key) {
super.missCount++;
return null;
}
@@ -142,15 +142,15 @@ public abstract class RecordCache<K> imp
private static class Default<K> extends RecordCache<K> {
- @Nonnull
+ @NotNull
private final Map<K, RecordId> records;
- @Nonnull
+ @NotNull
private final Weigher<K, RecordId> weigher;
private long weight = 0;
- static final <K> Supplier<RecordCache<K>> defaultFactory(final int size, @Nonnull final Weigher<K, RecordId> weigher) {
+ static final <K> Supplier<RecordCache<K>> defaultFactory(final int size, @NotNull final Weigher<K, RecordId> weigher) {
return new Supplier<RecordCache<K>>() {
@Override
public RecordCache<K> get() {
@@ -159,7 +159,7 @@ public abstract class RecordCache<K> imp
};
}
- Default(final int size, @Nonnull final Weigher<K, RecordId> weigher) {
+ Default(final int size, @NotNull final Weigher<K, RecordId> weigher) {
this.weigher = checkNotNull(weigher);
records = new LinkedHashMap<K, RecordId>(size * 4 / 3, 0.75f, true) {
@Override
@@ -176,14 +176,14 @@ public abstract class RecordCache<K> imp
}
@Override
- public synchronized void put(@Nonnull K key, @Nonnull RecordId value) {
+ public synchronized void put(@NotNull K key, @NotNull RecordId value) {
super.loadCount++;
records.put(key, value);
weight += weigher.weigh(key, value);
}
@Override
- public synchronized RecordId get(@Nonnull K key) {
+ public synchronized RecordId get(@NotNull K key) {
RecordId value = records.get(key);
if (value == null) {
super.missCount++;
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/RecordCacheStats.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/RecordCacheStats.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/RecordCacheStats.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/RecordCacheStats.java Wed Nov 7 14:34:38 2018
@@ -21,31 +21,30 @@ package org.apache.jackrabbit.oak.segmen
import static com.google.common.base.Preconditions.checkNotNull;
-import javax.annotation.Nonnull;
-
import com.google.common.base.Supplier;
import com.google.common.cache.CacheStats;
import org.apache.jackrabbit.oak.cache.AbstractCacheStats;
+import org.jetbrains.annotations.NotNull;
/**
* Statistics for {@link RecordCache}.
*/
public class RecordCacheStats extends AbstractCacheStats {
- @Nonnull
+ @NotNull
private final Supplier<CacheStats> stats;
- @Nonnull
+ @NotNull
private final Supplier<Long> elementCount;
- @Nonnull
+ @NotNull
private final Supplier<Long> weight;
public RecordCacheStats(
- @Nonnull String name,
- @Nonnull Supplier<CacheStats> stats,
- @Nonnull Supplier<Long> elementCount,
- @Nonnull Supplier<Long> weight) {
+ @NotNull String name,
+ @NotNull Supplier<CacheStats> stats,
+ @NotNull Supplier<Long> elementCount,
+ @NotNull Supplier<Long> weight) {
super(name);
this.stats = checkNotNull(stats);
this.elementCount = checkNotNull(elementCount);
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/RecordId.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/RecordId.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/RecordId.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/RecordId.java Wed Nov 7 14:34:38 2018
@@ -27,7 +27,7 @@ import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.annotation.Nonnull;
+import org.jetbrains.annotations.NotNull;
/**
* The record id. This includes the segment id and the offset within the
@@ -93,7 +93,7 @@ public final class RecordId implements C
return segmentId.asUUID();
}
- @Nonnull
+ @NotNull
public Segment getSegment() {
return segmentId.getSegment();
}
@@ -102,7 +102,7 @@ public final class RecordId implements C
* Serialise this record id into an array of bytes: {@code (msb, lsb, offset >> 2)}
* @return this record id as byte array
*/
- @Nonnull
+ @NotNull
ByteBuffer getBytes() {
byte[] buffer = new byte[SERIALIZED_RECORD_ID_BYTES];
BinaryUtils.writeLong(buffer, 0, segmentId.getMostSignificantBits());
@@ -114,7 +114,7 @@ public final class RecordId implements C
//--------------------------------------------------------< Comparable >--
@Override
- public int compareTo(@Nonnull RecordId that) {
+ public int compareTo(@NotNull RecordId that) {
checkNotNull(that);
int diff = segmentId.compareTo(that.segmentId);
if (diff == 0) {
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/RecordNumbers.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/RecordNumbers.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/RecordNumbers.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/RecordNumbers.java Wed Nov 7 14:34:38 2018
@@ -20,9 +20,8 @@ package org.apache.jackrabbit.oak.segmen
import java.util.Collections;
import java.util.Iterator;
-import javax.annotation.Nonnull;
-
import org.apache.jackrabbit.oak.segment.RecordNumbers.Entry;
+import org.jetbrains.annotations.NotNull;
/**
* A table to translate record numbers to offsets.
@@ -38,7 +37,7 @@ interface RecordNumbers extends Iterable
return -1;
}
- @Nonnull
+ @NotNull
@Override
public Iterator<Entry> iterator() {
return Collections.emptyIterator();
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/RecordUsageAnalyser.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/RecordUsageAnalyser.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/RecordUsageAnalyser.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/RecordUsageAnalyser.java Wed Nov 7 14:34:38 2018
@@ -25,7 +25,7 @@ import static org.apache.commons.io.File
import java.util.Formatter;
import java.util.Set;
-import javax.annotation.Nonnull;
+import org.jetbrains.annotations.NotNull;
/**
* This utility breaks down space usage per record type.
@@ -58,7 +58,7 @@ public class RecordUsageAnalyser extends
private long templateCount;
private long nodeCount;
- public RecordUsageAnalyser(@Nonnull SegmentReader reader) {
+ public RecordUsageAnalyser(@NotNull SegmentReader reader) {
super(reader);
}
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Revisions.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Revisions.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/Revisions.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Revisions.java Wed Nov 7 14:34:38 2018
@@ -19,10 +19,10 @@
package org.apache.jackrabbit.oak.segment;
-import javax.annotation.Nonnull;
-
import com.google.common.base.Function;
+import org.jetbrains.annotations.NotNull;
+
/**
* {@code Revisions} instances provide read and write access to
* the current head state. Implementations are thread safe
@@ -45,7 +45,7 @@ public interface Revisions {
* is a valid id for a {@code SegmentNodeState}.
* @return id of the head state
*/
- @Nonnull
+ @NotNull
RecordId getHead();
/**
@@ -53,7 +53,7 @@ public interface Revisions {
* The returned id is a valid id for a {@code SegmentNodeState}.
* @return id of the head state
*/
- @Nonnull
+ @NotNull
RecordId getPersistedHead();
/**
@@ -72,9 +72,9 @@ public interface Revisions {
* @return {@code true} if the current head was successfully
* updated, {@code false} otherwise.
*/
- boolean setHead(@Nonnull RecordId expected,
- @Nonnull RecordId head,
- @Nonnull Option... options);
+ boolean setHead(@NotNull RecordId expected,
+ @NotNull RecordId head,
+ @NotNull Option... options);
/**
* Atomically set the record id of the current head state to the value
@@ -95,8 +95,8 @@ public interface Revisions {
* Blocking implementations may throw this exception whe
* interrupted.
*/
- RecordId setHead(@Nonnull Function<RecordId, RecordId> newHead,
- @Nonnull Option... options)
+ RecordId setHead(@NotNull Function<RecordId, RecordId> newHead,
+ @NotNull Option... options)
throws InterruptedException;
}
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Segment.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Segment.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/Segment.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/Segment.java Wed Nov 7 14:34:38 2018
@@ -41,9 +41,6 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.UUID;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-
import com.google.common.base.Charsets;
import com.google.common.collect.AbstractIterator;
import org.apache.commons.io.HexDump;
@@ -57,6 +54,8 @@ import org.apache.jackrabbit.oak.segment
import org.apache.jackrabbit.oak.segment.data.SegmentData;
import org.apache.jackrabbit.oak.segment.data.StringData;
import org.apache.jackrabbit.oak.segment.file.tar.GCGeneration;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* A list of records.
@@ -132,10 +131,10 @@ public class Segment {
static final int RECORD_NUMBER_COUNT_OFFSET = 18;
- @Nonnull
+ @NotNull
private final SegmentReader reader;
- @Nonnull
+ @NotNull
private final SegmentId id;
private final SegmentData data;
@@ -143,7 +142,7 @@ public class Segment {
/**
* Version of the segment storage format.
*/
- @Nonnull
+ @NotNull
private final SegmentVersion version;
/**
@@ -169,12 +168,12 @@ public class Segment {
}
Segment(
- @Nonnull SegmentId id,
- @Nonnull SegmentReader reader,
- @Nonnull byte[] buffer,
- @Nonnull RecordNumbers recordNumbers,
- @Nonnull SegmentReferences segmentReferences,
- @Nonnull String info
+ @NotNull SegmentId id,
+ @NotNull SegmentReader reader,
+ @NotNull byte[] buffer,
+ @NotNull RecordNumbers recordNumbers,
+ @NotNull SegmentReferences segmentReferences,
+ @NotNull String info
) {
this.id = checkNotNull(id);
this.reader = checkNotNull(reader);
@@ -190,10 +189,10 @@ public class Segment {
id.loaded(this);
}
- public Segment(@Nonnull SegmentIdProvider idProvider,
- @Nonnull SegmentReader reader,
- @Nonnull final SegmentId id,
- @Nonnull final ByteBuffer data) {
+ public Segment(@NotNull SegmentIdProvider idProvider,
+ @NotNull SegmentReader reader,
+ @NotNull final SegmentId id,
+ @NotNull final ByteBuffer data) {
this.reader = checkNotNull(reader);
this.id = checkNotNull(id);
if (id.isDataSegmentId()) {
@@ -293,7 +292,7 @@ public class Segment {
return id;
}
- @Nonnull
+ @NotNull
@Override
public Iterator<SegmentId> iterator() {
return new AbstractIterator<SegmentId>() {
@@ -356,7 +355,7 @@ public class Segment {
* generations (i.e. stay at 0).
* @return the gc generation of this segment or 0 if this is bulk segment.
*/
- @Nonnull
+ @NotNull
public GCGeneration getGcGeneration() {
return getGcGeneration(data, id.asUUID());
}
@@ -378,7 +377,7 @@ public class Segment {
* </ul>
* @return the segment meta data
*/
- @CheckForNull
+ @Nullable
String getSegmentInfo() {
if (info == null && id.isDataSegmentId()) {
info = readString(recordNumbers.iterator().next().getRecordNumber());
@@ -422,7 +421,7 @@ public class Segment {
return data.readBytes(recordNumbers.getOffset(recordNumber) + position, length);
}
- @Nonnull
+ @NotNull
RecordId readRecordId(int recordNumber, int rawOffset, int recordIdOffset) {
int offset = recordNumbers.getOffset(recordNumber) + rawOffset + recordIdOffset * RecordIdData.BYTES;
RecordIdData recordIdData = data.readRecordId(offset);
@@ -437,7 +436,7 @@ public class Segment {
return readRecordId(recordNumber, 0, 0);
}
- @Nonnull
+ @NotNull
private SegmentId dereferenceSegmentId(int reference) {
if (reference == 0) {
return id;
@@ -452,7 +451,7 @@ public class Segment {
return id;
}
- @Nonnull
+ @NotNull
String readString(int recordNumber) {
StringData data = this.data.readString(recordNumbers.getOffset(recordNumber));
@@ -472,7 +471,7 @@ public class Segment {
throw new IllegalStateException("Invalid return value");
}
- @Nonnull
+ @NotNull
Template readTemplate(int recordNumber) {
int head = readInt(recordNumber);
boolean hasPrimaryType = (head & (1 << 31)) != 0;
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentBlob.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentBlob.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/SegmentBlob.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentBlob.java Wed Nov 7 14:34:38 2018
@@ -29,21 +29,19 @@ import java.io.InputStream;
import java.util.List;
import java.util.Set;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
import org.apache.jackrabbit.oak.api.Blob;
import org.apache.jackrabbit.oak.plugins.blob.BlobStoreBlob;
import org.apache.jackrabbit.oak.plugins.memory.AbstractBlob;
import org.apache.jackrabbit.oak.spi.blob.BlobStore;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* A BLOB (stream of bytes). This is a record of type "VALUE".
*/
public class SegmentBlob extends Record implements Blob {
- @CheckForNull
+ @Nullable
private final BlobStore blobStore;
public static Iterable<SegmentId> getBulkSegmentIds(Blob blob) {
@@ -54,7 +52,7 @@ public class SegmentBlob extends Record
}
}
- SegmentBlob(@Nullable BlobStore blobStore, @Nonnull RecordId id) {
+ SegmentBlob(@Nullable BlobStore blobStore, @NotNull RecordId id) {
super(id);
this.blobStore = blobStore;
}
@@ -63,7 +61,7 @@ public class SegmentBlob extends Record
return new SegmentStream(getRecordId(), segment.readBytes(getRecordNumber(), offset, length), length);
}
- @Override @Nonnull
+ @Override @NotNull
public InputStream getNewStream() {
Segment segment = getSegment();
byte head = segment.readByte(getRecordNumber());
@@ -118,7 +116,7 @@ public class SegmentBlob extends Record
}
@Override
- @CheckForNull
+ @Nullable
public String getReference() {
String blobId = getBlobId();
if (blobId != null) {
@@ -149,13 +147,13 @@ public class SegmentBlob extends Record
return (head & 0xf0) == 0xe0 || (head & 0xf8) == 0xf0;
}
- @CheckForNull
+ @Nullable
public String getBlobId() {
return readBlobId(getSegment(), getRecordNumber());
}
- @CheckForNull
- public static String readBlobId(@Nonnull Segment segment, int recordNumber) {
+ @Nullable
+ public static String readBlobId(@NotNull Segment segment, int recordNumber) {
byte head = segment.readByte(recordNumber);
if ((head & 0xf0) == 0xe0) {
// 1110 xxxx: external value, small blob ID
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentBufferWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentBufferWriter.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/SegmentBufferWriter.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentBufferWriter.java Wed Nov 7 14:34:38 2018
@@ -43,12 +43,11 @@ import java.io.PrintStream;
import java.util.Collection;
import java.util.Set;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-
import org.apache.commons.io.HexDump;
import org.apache.jackrabbit.oak.segment.RecordNumbers.Entry;
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;
@@ -99,19 +98,19 @@ public class SegmentBufferWriter impleme
private MutableSegmentReferences segmentReferences = new MutableSegmentReferences();
- @Nonnull
+ @NotNull
private final SegmentIdProvider idProvider;
- @Nonnull
+ @NotNull
private final SegmentReader reader;
/**
* Id of this writer.
*/
- @Nonnull
+ @NotNull
private final String wid;
- @Nonnull
+ @NotNull
private final GCGeneration gcGeneration;
/**
@@ -142,10 +141,10 @@ public class SegmentBufferWriter impleme
*/
private boolean dirty;
- public SegmentBufferWriter(@Nonnull SegmentIdProvider idProvider,
- @Nonnull SegmentReader reader,
- @CheckForNull String wid,
- @Nonnull GCGeneration gcGeneration) {
+ public SegmentBufferWriter(@NotNull SegmentIdProvider idProvider,
+ @NotNull SegmentReader reader,
+ @Nullable String wid,
+ @NotNull GCGeneration gcGeneration) {
this.idProvider = checkNotNull(idProvider);
this.reader = checkNotNull(reader);
this.wid = (wid == null
@@ -155,13 +154,13 @@ public class SegmentBufferWriter impleme
this.gcGeneration = checkNotNull(gcGeneration);
}
- @Nonnull
+ @NotNull
@Override
- public RecordId execute(@Nonnull WriteOperation writeOperation) throws IOException {
+ public RecordId execute(@NotNull WriteOperation writeOperation) throws IOException {
return writeOperation.execute(this);
}
- @Nonnull
+ @NotNull
GCGeneration getGCGeneration() {
return gcGeneration;
}
@@ -311,7 +310,7 @@ public class SegmentBufferWriter impleme
* enough space for a record. It can also be called explicitly.
*/
@Override
- public void flush(@Nonnull SegmentStore store) throws IOException {
+ public void flush(@NotNull SegmentStore store) throws IOException {
if (dirty) {
int referencedSegmentIdCount = segmentReferences.size();
BinaryUtils.writeInt(buffer, Segment.REFERENCED_SEGMENT_ID_COUNT_OFFSET, referencedSegmentIdCount);
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentBufferWriterPool.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentBufferWriterPool.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/SegmentBufferWriterPool.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentBufferWriterPool.java Wed Nov 7 14:34:38 2018
@@ -31,12 +31,11 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import javax.annotation.Nonnull;
-
import com.google.common.base.Supplier;
import com.google.common.util.concurrent.Monitor;
import com.google.common.util.concurrent.Monitor.Guard;
import org.apache.jackrabbit.oak.segment.file.tar.GCGeneration;
+import org.jetbrains.annotations.NotNull;
/**
* This {@link WriteOperationHandler} uses a pool of {@link SegmentBufferWriter}s,
@@ -73,34 +72,34 @@ public class SegmentBufferWriterPool imp
*/
private final Set<SegmentBufferWriter> disposedOldGen = newHashSet();
- @Nonnull
+ @NotNull
private final SegmentIdProvider idProvider;
- @Nonnull
+ @NotNull
private final SegmentReader reader;
- @Nonnull
+ @NotNull
private final Supplier<GCGeneration> gcGeneration;
- @Nonnull
+ @NotNull
private final String wid;
private short writerId = -1;
public SegmentBufferWriterPool(
- @Nonnull SegmentIdProvider idProvider,
- @Nonnull SegmentReader reader,
- @Nonnull String wid,
- @Nonnull Supplier<GCGeneration> gcGeneration) {
+ @NotNull SegmentIdProvider idProvider,
+ @NotNull SegmentReader reader,
+ @NotNull String wid,
+ @NotNull Supplier<GCGeneration> gcGeneration) {
this.idProvider = checkNotNull(idProvider);
this.reader = checkNotNull(reader);
this.wid = checkNotNull(wid);
this.gcGeneration = checkNotNull(gcGeneration);
}
- @Nonnull
+ @NotNull
@Override
- public RecordId execute(@Nonnull WriteOperation writeOperation) throws IOException {
+ public RecordId execute(@NotNull WriteOperation writeOperation) throws IOException {
SegmentBufferWriter writer = borrowWriter(currentThread());
try {
return writeOperation.execute(writer);
@@ -110,7 +109,7 @@ public class SegmentBufferWriterPool imp
}
@Override
- public void flush(@Nonnull SegmentStore store) throws IOException {
+ public void flush(@NotNull SegmentStore store) throws IOException {
List<SegmentBufferWriter> toFlush = newArrayList();
List<SegmentBufferWriter> toReturn = newArrayList();
@@ -158,7 +157,7 @@ public class SegmentBufferWriterPool imp
* Create a {@code Guard} that is satisfied if and only if {@link #disposed}
* contains all items in {@code toReturn}
*/
- @Nonnull
+ @NotNull
private Guard allReturned(final List<SegmentBufferWriter> toReturn) {
return new Guard(poolMonitor) {
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentCache.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/SegmentCache.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentCache.java Wed Nov 7 14:34:38 2018
@@ -26,14 +26,13 @@ import java.util.concurrent.ExecutionExc
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
-import javax.annotation.Nonnull;
-
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheStats;
import com.google.common.cache.RemovalNotification;
import org.apache.jackrabbit.oak.cache.AbstractCacheStats;
import org.apache.jackrabbit.oak.segment.CacheWeights.SegmentCacheWeigher;
+import org.jetbrains.annotations.NotNull;
/**
* A cache for {@link SegmentId#isDataSegmentId() data} {@link Segment}
@@ -60,14 +59,14 @@ public class SegmentCache {
/**
* Cache of recently accessed segments
*/
- @Nonnull
+ @NotNull
private final Cache<SegmentId, Segment> cache;
/**
* Statistics of this cache. Do to the special access patter (see class
* comment), we cannot rely on {@link Cache#stats()}.
*/
- @Nonnull
+ @NotNull
private final Stats stats = new Stats("Segment Cache");
/**
@@ -88,7 +87,7 @@ public class SegmentCache {
/**
* Removal handler called whenever an item is evicted from the cache.
*/
- private void onRemove(@Nonnull RemovalNotification<SegmentId, Segment> notification) {
+ private void onRemove(@NotNull RemovalNotification<SegmentId, Segment> notification) {
stats.evictionCount.incrementAndGet();
if (notification.getValue() != null) {
stats.currentWeight.addAndGet(-segmentWeight(notification.getValue()));
@@ -107,8 +106,8 @@ public class SegmentCache {
* @return the segment identified by {@code id}
* @throws ExecutionException when {@code loader} failed to load an segment
*/
- @Nonnull
- public Segment getSegment(@Nonnull final SegmentId id, @Nonnull final Callable<Segment> loader) throws ExecutionException {
+ @NotNull
+ public Segment getSegment(@NotNull final SegmentId id, @NotNull final Callable<Segment> loader) throws ExecutionException {
if (id.isDataSegmentId()) {
return cache.get(id, () -> {
try {
@@ -140,7 +139,7 @@ public class SegmentCache {
*
* @param segment the segment to cache
*/
- public void putSegment(@Nonnull Segment segment) {
+ public void putSegment(@NotNull Segment segment) {
SegmentId id = segment.getSegmentId();
if (id.isDataSegmentId()) {
@@ -166,7 +165,7 @@ public class SegmentCache {
/**
* @return Statistics for this cache.
*/
- @Nonnull
+ @NotNull
public AbstractCacheStats getCacheStats() {
return stats;
}
@@ -187,28 +186,28 @@ public class SegmentCache {
*/
private class Stats extends AbstractCacheStats {
- @Nonnull
+ @NotNull
final AtomicLong currentWeight = new AtomicLong();
- @Nonnull
+ @NotNull
final AtomicLong loadSuccessCount = new AtomicLong();
- @Nonnull
+ @NotNull
final AtomicInteger loadExceptionCount = new AtomicInteger();
- @Nonnull
+ @NotNull
final AtomicLong loadTime = new AtomicLong();
- @Nonnull
+ @NotNull
final AtomicLong evictionCount = new AtomicLong();
- @Nonnull
+ @NotNull
final AtomicLong hitCount = new AtomicLong();
- @Nonnull
+ @NotNull
final AtomicLong missCount = new AtomicLong();
- protected Stats(@Nonnull String name) {
+ protected Stats(@NotNull String name) {
super(name);
}
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentDiscoveryLiteDescriptors.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentDiscoveryLiteDescriptors.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/SegmentDiscoveryLiteDescriptors.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentDiscoveryLiteDescriptors.java Wed Nov 7 14:34:38 2018
@@ -17,13 +17,13 @@
package org.apache.jackrabbit.oak.segment;
-import javax.annotation.Nonnull;
import javax.jcr.Value;
import org.apache.jackrabbit.commons.SimpleValueFactory;
import org.apache.jackrabbit.oak.api.Descriptors;
import org.apache.jackrabbit.oak.spi.cluster.ClusterRepositoryInfo;
import org.apache.jackrabbit.oak.spi.state.NodeStore;
+import org.jetbrains.annotations.NotNull;
/**
* This provides the 'clusterView' repository descriptors
@@ -44,24 +44,24 @@ class SegmentDiscoveryLiteDescriptors im
this.store = store;
}
- @Nonnull
+ @NotNull
@Override
public String[] getKeys() {
return new String[] {OAK_DISCOVERYLITE_CLUSTERVIEW};
}
@Override
- public boolean isStandardDescriptor(@Nonnull String key) {
+ public boolean isStandardDescriptor(@NotNull String key) {
return OAK_DISCOVERYLITE_CLUSTERVIEW.equals(key);
}
@Override
- public boolean isSingleValueDescriptor(@Nonnull String key) {
+ public boolean isSingleValueDescriptor(@NotNull String key) {
return OAK_DISCOVERYLITE_CLUSTERVIEW.equals(key);
}
@Override
- public Value getValue(@Nonnull String key) {
+ public Value getValue(@NotNull String key) {
if (!OAK_DISCOVERYLITE_CLUSTERVIEW.equals(key)) {
return null;
}
@@ -69,7 +69,7 @@ class SegmentDiscoveryLiteDescriptors im
}
@Override
- public Value[] getValues(@Nonnull String key) {
+ public Value[] getValues(@NotNull String key) {
if (!OAK_DISCOVERYLITE_CLUSTERVIEW.equals(key)) {
return null;
}
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentId.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentId.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/SegmentId.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentId.java Wed Nov 7 14:34:38 2018
@@ -23,11 +23,10 @@ import static org.apache.jackrabbit.oak.
import java.util.UUID;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-
import org.apache.jackrabbit.oak.commons.StringUtils;
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;
@@ -55,7 +54,7 @@ public class SegmentId implements Compar
return (lsb >>> 60) == 0xAL;
}
- @Nonnull
+ @NotNull
private final SegmentStore store;
private final long msb;
@@ -70,13 +69,13 @@ public class SegmentId implements Compar
/**
* The gc generation of this segment or -1 if unknown.
*/
- @CheckForNull
+ @Nullable
private GCGeneration gcGeneration;
/**
* The gc info of this segment if it has been reclaimed or {@code null} otherwise.
*/
- @CheckForNull
+ @Nullable
private String gcInfo;
/**
@@ -92,7 +91,7 @@ public class SegmentId implements Compar
* @param lsb least significant bits of this id
* @param onAccess callback called whenever an underlying and locally memoised segment is accessed.
*/
- public SegmentId(@Nonnull SegmentStore store, long msb, long lsb, @Nonnull Runnable onAccess) {
+ public SegmentId(@NotNull SegmentStore store, long msb, long lsb, @NotNull Runnable onAccess) {
this.store = store;
this.msb = msb;
this.lsb = lsb;
@@ -106,7 +105,7 @@ public class SegmentId implements Compar
* @param msb most significant bits of this id
* @param lsb least significant bits of this id
*/
- public SegmentId(@Nonnull SegmentStore store, long msb, long lsb) {
+ public SegmentId(@NotNull SegmentStore store, long msb, long lsb) {
this(store, msb, lsb, () -> {});
}
@@ -143,7 +142,7 @@ public class SegmentId implements Compar
* @see #loaded(Segment)
* @see #unloaded()
*/
- @Nonnull
+ @NotNull
public Segment getSegment() {
Segment segment = this.segment;
if (segment == null) {
@@ -163,7 +162,7 @@ public class SegmentId implements Compar
* @return garbage collection related information like the age of this segment
* id, the generation of its segment and information about its gc status.
*/
- @Nonnull
+ @NotNull
String gcInfo() {
StringBuilder sb = new StringBuilder();
sb.append("SegmentId age=").append(System.currentTimeMillis() - creationTime).append("ms");
@@ -177,7 +176,7 @@ public class SegmentId implements Compar
}
/* For testing only */
- @CheckForNull
+ @Nullable
String getGcInfo() {
return gcInfo;
}
@@ -189,7 +188,7 @@ public class SegmentId implements Compar
* is logged along with the {@code SegmentNotFoundException}
* when attempting to resolve the segment of this id.
*/
- public void reclaimed(@Nonnull String gcInfo) {
+ public void reclaimed(@NotNull String gcInfo) {
this.gcInfo = gcInfo;
}
@@ -200,7 +199,7 @@ public class SegmentId implements Compar
* @see #getSegment()
* @see #unloaded()
*/
- void loaded(@Nonnull Segment segment) {
+ void loaded(@NotNull Segment segment) {
this.segment = segment;
this.gcGeneration = segment.getGcGeneration();
}
@@ -220,7 +219,7 @@ public class SegmentId implements Compar
* @param store
* @return {@code true} iff this instance belongs to {@code store}
*/
- public boolean sameStore(@Nonnull SegmentStore store) {
+ public boolean sameStore(@NotNull SegmentStore store) {
return this.store == store;
}
@@ -240,7 +239,7 @@ public class SegmentId implements Compar
* get loaded if the generation info is missing
* @return the segment's gc generation
*/
- @Nonnull
+ @NotNull
public GCGeneration getGcGeneration() {
if (gcGeneration == null) {
getSegment();
@@ -251,7 +250,7 @@ public class SegmentId implements Compar
// --------------------------------------------------------< Comparable >--
@Override
- public int compareTo(@Nonnull SegmentId that) {
+ public int compareTo(@NotNull SegmentId that) {
int d = Long.valueOf(this.msb).compareTo(that.msb);
if (d == 0) {
d = Long.valueOf(this.lsb).compareTo(that.lsb);
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentIdFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentIdFactory.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/SegmentIdFactory.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentIdFactory.java Wed Nov 7 14:34:38 2018
@@ -17,7 +17,7 @@
package org.apache.jackrabbit.oak.segment;
-import javax.annotation.Nonnull;
+import org.jetbrains.annotations.NotNull;
/**
* A factory for {@link SegmentId} given their representation in MSB/LSB longs.
@@ -38,7 +38,7 @@ public interface SegmentIdFactory {
* @return An instance of {@link SegmentId}. The returned instance is never
* {@code null}.
*/
- @Nonnull
+ @NotNull
SegmentId newSegmentId(long msb, long lsb);
}
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentIdProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentIdProvider.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/SegmentIdProvider.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentIdProvider.java Wed Nov 7 14:34:38 2018
@@ -18,7 +18,7 @@
package org.apache.jackrabbit.oak.segment;
-import javax.annotation.Nonnull;
+import org.jetbrains.annotations.NotNull;
/**
* Instances of this class provides {@link SegmentId} instances of a given
@@ -39,7 +39,7 @@ public interface SegmentIdProvider {
* @param lsb The least significant bits of the {@code SegmentId}.
* @return A non-{@code null} instance of {@code SegmentId}.
*/
- @Nonnull
+ @NotNull
SegmentId newSegmentId(long msb, long lsb);
@@ -48,7 +48,7 @@ public interface SegmentIdProvider {
*
* @return A non-{@code null} instance of {@code SegmentId}.
*/
- @Nonnull
+ @NotNull
SegmentId newDataSegmentId();
@@ -57,6 +57,6 @@ public interface SegmentIdProvider {
*
* @return A non-{@code null} instance of {@code SegmentId}.
*/
- @Nonnull
+ @NotNull
SegmentId newBulkSegmentId();
}
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentIdTable.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentIdTable.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/SegmentIdTable.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentIdTable.java Wed Nov 7 14:34:38 2018
@@ -30,8 +30,7 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
-import javax.annotation.Nonnull;
-
+import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -87,7 +86,7 @@ public class SegmentIdTable {
* @param maker A non-{@code null} instance of {@link SegmentIdFactory}.
* @return the segment id
*/
- @Nonnull
+ @NotNull
synchronized SegmentId newSegmentId(long msb, long lsb, SegmentIdFactory maker) {
int index = getIndex(lsb);
boolean shouldRefresh = false;
@@ -195,7 +194,7 @@ public class SegmentIdTable {
return ((int) lsb) & (references.size() - 1);
}
- synchronized void clearSegmentIdTables(@Nonnull Set<UUID> reclaimed, @Nonnull String gcInfo) {
+ synchronized void clearSegmentIdTables(@NotNull Set<UUID> reclaimed, @NotNull String gcInfo) {
for (WeakReference<SegmentId> reference : references) {
if (reference != null) {
SegmentId id = reference.get();
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeBuilder.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/SegmentNodeBuilder.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeBuilder.java Wed Nov 7 14:34:38 2018
@@ -23,13 +23,12 @@ import static com.google.common.base.Pre
import java.io.IOException;
import java.io.InputStream;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
import org.apache.jackrabbit.oak.api.Blob;
import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder;
import org.apache.jackrabbit.oak.spi.blob.BlobStore;
import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,10 +51,10 @@ public class SegmentNodeBuilder extends
@Nullable
private final BlobStore blobStore;
- @Nonnull
+ @NotNull
private final SegmentReader reader;
- @Nonnull
+ @NotNull
private final SegmentWriter writer;
/**
@@ -73,10 +72,10 @@ public class SegmentNodeBuilder extends
private long updateCount;
SegmentNodeBuilder(
- @Nonnull SegmentNodeState base,
+ @NotNull SegmentNodeState base,
@Nullable BlobStore blobStore,
- @Nonnull SegmentReader reader,
- @Nonnull SegmentWriter writer) {
+ @NotNull SegmentReader reader,
+ @NotNull SegmentWriter writer) {
super(base);
this.blobStore = blobStore;
this.reader = reader;
@@ -85,11 +84,11 @@ public class SegmentNodeBuilder extends
}
private SegmentNodeBuilder(
- @Nonnull SegmentNodeBuilder parent,
- @Nonnull String name,
+ @NotNull SegmentNodeBuilder parent,
+ @NotNull String name,
@Nullable BlobStore blobStore,
- @Nonnull SegmentReader reader,
- @Nonnull SegmentWriter writer) {
+ @NotNull SegmentReader reader,
+ @NotNull SegmentWriter writer) {
super(parent, name);
this.blobStore = blobStore;
this.reader = reader;
@@ -124,7 +123,7 @@ public class SegmentNodeBuilder extends
//-------------------------------------------------------< NodeBuilder >--
- @Nonnull
+ @NotNull
@Override
public SegmentNodeState getNodeState() {
try {
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeState.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/SegmentNodeState.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeState.java Wed Nov 7 14:34:38 2018
@@ -41,10 +41,6 @@ import java.util.Collections;
import java.util.List;
import java.util.UUID;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import org.apache.jackrabbit.oak.api.PropertyState;
@@ -56,19 +52,21 @@ import org.apache.jackrabbit.oak.spi.sta
import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* A record of type "NODE". This class can read a node record from a segment. It
* currently doesn't cache data (but the template is fully loaded).
*/
public class SegmentNodeState extends Record implements NodeState {
- @Nonnull
+ @NotNull
private final SegmentReader reader;
@Nullable
private final BlobStore blobStore;
- @Nonnull
+ @NotNull
private final Supplier<SegmentWriter> writer;
private volatile RecordId templateId = null;
@@ -76,10 +74,10 @@ public class SegmentNodeState extends Re
private volatile Template template = null;
SegmentNodeState(
- @Nonnull SegmentReader reader,
- @Nonnull Supplier<SegmentWriter> writer,
+ @NotNull SegmentReader reader,
+ @NotNull Supplier<SegmentWriter> writer,
@Nullable BlobStore blobStore,
- @Nonnull RecordId id) {
+ @NotNull RecordId id) {
super(id);
this.reader = checkNotNull(reader);
this.writer = checkNotNull(memoize(writer));
@@ -87,10 +85,10 @@ public class SegmentNodeState extends Re
}
public SegmentNodeState(
- @Nonnull SegmentReader reader,
- @Nonnull SegmentWriter writer,
+ @NotNull SegmentReader reader,
+ @NotNull SegmentWriter writer,
@Nullable BlobStore blobStore,
- @Nonnull RecordId id) {
+ @NotNull RecordId id) {
this(reader, Suppliers.ofInstance(writer), blobStore, id);
}
@@ -117,8 +115,8 @@ public class SegmentNodeState extends Re
return reader.readMap(segment.readRecordId(getRecordNumber(), 0, 2));
}
- @Nonnull
- static String getStableId(@Nonnull ByteBuffer stableId) {
+ @NotNull
+ static String getStableId(@NotNull ByteBuffer stableId) {
ByteBuffer buffer = stableId.duplicate();
long msb = buffer.getLong();
long lsb = buffer.getLong();
@@ -180,7 +178,7 @@ public class SegmentNodeState extends Re
}
@Override
- public boolean hasProperty(@Nonnull String name) {
+ public boolean hasProperty(@NotNull String name) {
checkNotNull(name);
Template template = getTemplate();
switch (name) {
@@ -193,8 +191,8 @@ public class SegmentNodeState extends Re
}
}
- @Override @CheckForNull
- public PropertyState getProperty(@Nonnull String name) {
+ @Override @Nullable
+ public PropertyState getProperty(@NotNull String name) {
checkNotNull(name);
Template template = getTemplate();
PropertyState property = null;
@@ -229,7 +227,7 @@ public class SegmentNodeState extends Re
return pIds.getEntry(propertyTemplate.getIndex());
}
- @Override @Nonnull
+ @Override @NotNull
public Iterable<PropertyState> getProperties() {
Template template = getTemplate();
PropertyTemplate[] propertyTemplates = template.getPropertyTemplates();
@@ -264,7 +262,7 @@ public class SegmentNodeState extends Re
}
@Override
- public boolean getBoolean(@Nonnull String name) {
+ public boolean getBoolean(@NotNull String name) {
return Boolean.TRUE.toString().equals(getValueAsString(name, BOOLEAN));
}
@@ -278,23 +276,23 @@ public class SegmentNodeState extends Re
}
}
- @Override @CheckForNull
+ @Override @Nullable
public String getString(String name) {
return getValueAsString(name, STRING);
}
- @Override @Nonnull
- public Iterable<String> getStrings(@Nonnull String name) {
+ @Override @NotNull
+ public Iterable<String> getStrings(@NotNull String name) {
return getValuesAsStrings(name, STRINGS);
}
- @Override @CheckForNull
- public String getName(@Nonnull String name) {
+ @Override @Nullable
+ public String getName(@NotNull String name) {
return getValueAsString(name, NAME);
}
- @Override @Nonnull
- public Iterable<String> getNames(@Nonnull String name) {
+ @Override @NotNull
+ public Iterable<String> getNames(@NotNull String name) {
return getValuesAsStrings(name, NAMES);
}
@@ -307,7 +305,7 @@ public class SegmentNodeState extends Re
* @param type property type
* @return string value of the property, or {@code null}
*/
- @CheckForNull
+ @Nullable
private String getValueAsString(String name, Type<?> type) {
checkArgument(!type.isArray());
@@ -347,7 +345,7 @@ public class SegmentNodeState extends Re
* @param type property type
* @return string values of the property, or an empty iterable
*/
- @Nonnull
+ @NotNull
private Iterable<String> getValuesAsStrings(String name, Type<?> type) {
checkArgument(type.isArray());
@@ -405,7 +403,7 @@ public class SegmentNodeState extends Re
}
@Override
- public boolean hasChildNode(@Nonnull String name) {
+ public boolean hasChildNode(@NotNull String name) {
String childName = getTemplate().getChildName();
if (childName == Template.ZERO_CHILD_NODES) {
return false;
@@ -416,8 +414,8 @@ public class SegmentNodeState extends Re
}
}
- @Override @Nonnull
- public NodeState getChildNode(@Nonnull String name) {
+ @Override @NotNull
+ public NodeState getChildNode(@NotNull String name) {
String childName = getTemplate().getChildName();
if (childName == Template.MANY_CHILD_NODES) {
MapEntry child = getChildNodeMap().getEntry(name);
@@ -433,7 +431,7 @@ public class SegmentNodeState extends Re
return MISSING_NODE;
}
- @Override @Nonnull
+ @Override @NotNull
public Iterable<String> getChildNodeNames() {
String childName = getTemplate().getChildName();
if (childName == Template.ZERO_CHILD_NODES) {
@@ -445,7 +443,7 @@ public class SegmentNodeState extends Re
}
}
- @Override @Nonnull
+ @Override @NotNull
public Iterable<? extends ChildNodeEntry> getChildNodeEntries() {
String childName = getTemplate().getChildName();
if (childName == Template.ZERO_CHILD_NODES) {
@@ -459,7 +457,7 @@ public class SegmentNodeState extends Re
}
}
- @Override @Nonnull
+ @Override @NotNull
public SegmentNodeBuilder builder() {
return new SegmentNodeBuilder(this, blobStore, reader, writer.get());
}
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStore.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/SegmentNodeStore.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStore.java Wed Nov 7 14:34:38 2018
@@ -30,10 +30,6 @@ import java.io.InputStream;
import java.util.Collections;
import java.util.Map;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
import org.apache.jackrabbit.oak.api.Blob;
import org.apache.jackrabbit.oak.api.CommitFailedException;
import org.apache.jackrabbit.oak.api.PropertyState;
@@ -51,6 +47,8 @@ import org.apache.jackrabbit.oak.spi.sta
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.apache.jackrabbit.oak.spi.state.NodeStore;
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;
@@ -65,29 +63,29 @@ public class SegmentNodeStore implements
public static class SegmentNodeStoreBuilder {
private static final Logger LOG = LoggerFactory.getLogger(SegmentNodeStoreBuilder.class);
- @Nonnull
+ @NotNull
private final Revisions revisions;
- @Nonnull
+ @NotNull
private final SegmentReader reader;
- @Nonnull
+ @NotNull
private final SegmentWriter writer;
- @CheckForNull
+ @Nullable
private final BlobStore blobStore;
private boolean isCreated;
private boolean dispatchChanges = true;
- @Nonnull
+ @NotNull
private StatisticsProvider statsProvider = StatisticsProvider.NOOP;
private SegmentNodeStoreBuilder(
- @Nonnull Revisions revisions,
- @Nonnull SegmentReader reader,
- @Nonnull SegmentWriter writer,
+ @NotNull Revisions revisions,
+ @NotNull SegmentReader reader,
+ @NotNull SegmentWriter writer,
@Nullable BlobStore blobStore) {
this.revisions = revisions;
this.reader = reader;
@@ -96,7 +94,7 @@ public class SegmentNodeStore implements
}
- @Nonnull
+ @NotNull
public SegmentNodeStoreBuilder dispatchChanges(boolean dispatchChanges) {
this.dispatchChanges = dispatchChanges;
return this;
@@ -107,13 +105,13 @@ public class SegmentNodeStore implements
* @param statisticsProvider
* @return this instance
*/
- @Nonnull
- public SegmentNodeStoreBuilder withStatisticsProvider(@Nonnull StatisticsProvider statisticsProvider) {
+ @NotNull
+ public SegmentNodeStoreBuilder withStatisticsProvider(@NotNull StatisticsProvider statisticsProvider) {
this.statsProvider = checkNotNull(statisticsProvider);
return this;
}
- @Nonnull
+ @NotNull
public SegmentNodeStore build() {
checkState(!isCreated);
isCreated = true;
@@ -121,8 +119,8 @@ public class SegmentNodeStore implements
return new SegmentNodeStore(this);
}
- @Nonnull
- private static String getString(@CheckForNull BlobStore blobStore) {
+ @NotNull
+ private static String getString(@Nullable BlobStore blobStore) {
return "blobStore=" + (blobStore == null ? "inline" : blobStore);
}
@@ -134,11 +132,11 @@ public class SegmentNodeStore implements
}
}
- @Nonnull
+ @NotNull
public static SegmentNodeStoreBuilder builder(
- @Nonnull Revisions revisions,
- @Nonnull SegmentReader reader,
- @Nonnull SegmentWriter writer,
+ @NotNull Revisions revisions,
+ @NotNull SegmentReader reader,
+ @NotNull SegmentWriter writer,
@Nullable BlobStore blobStore) {
return new SegmentNodeStoreBuilder(checkNotNull(revisions),
checkNotNull(reader), checkNotNull(writer), blobStore);
@@ -148,13 +146,13 @@ public class SegmentNodeStore implements
public static final String CHECKPOINTS = "checkpoints";
- @Nonnull
+ @NotNull
private final SegmentWriter writer;
- @Nonnull
+ @NotNull
private final Scheduler scheduler;
- @CheckForNull
+ @Nullable
private final BlobStore blobStore;
private final SegmentNodeStoreStats stats;
@@ -180,23 +178,23 @@ public class SegmentNodeStore implements
return () -> {};
}
- @Override @Nonnull
+ @Override @NotNull
public NodeState getRoot() {
return scheduler.getHeadNodeState().getChildNode(ROOT);
}
- @Nonnull
+ @NotNull
@Override
public NodeState merge(
- @Nonnull NodeBuilder builder, @Nonnull CommitHook commitHook,
- @Nonnull CommitInfo info) throws CommitFailedException {
+ @NotNull NodeBuilder builder, @NotNull CommitHook commitHook,
+ @NotNull CommitInfo info) throws CommitFailedException {
checkArgument(builder instanceof SegmentNodeBuilder);
checkArgument(((SegmentNodeBuilder) builder).isRootBuilder());
return scheduler.schedule(new Commit(builder, commitHook, info));
}
- @Override @Nonnull
- public NodeState rebase(@Nonnull NodeBuilder builder) {
+ @Override @NotNull
+ public NodeState rebase(@NotNull NodeBuilder builder) {
checkArgument(builder instanceof SegmentNodeBuilder);
SegmentNodeBuilder snb = (SegmentNodeBuilder) builder;
@@ -213,8 +211,8 @@ public class SegmentNodeStore implements
return snb.getNodeState();
}
- @Override @Nonnull
- public NodeState reset(@Nonnull NodeBuilder builder) {
+ @Override @NotNull
+ public NodeState reset(@NotNull NodeBuilder builder) {
checkArgument(builder instanceof SegmentNodeBuilder);
SegmentNodeBuilder snb = (SegmentNodeBuilder) builder;
@@ -225,14 +223,14 @@ public class SegmentNodeStore implements
return root;
}
- @Nonnull
+ @NotNull
@Override
public Blob createBlob(InputStream stream) throws IOException {
return new SegmentBlob(blobStore, writer.writeStream(stream));
}
@Override
- public Blob getBlob(@Nonnull String reference) {
+ public Blob getBlob(@NotNull String reference) {
//Use of 'reference' here is bit overloaded. In terms of NodeStore API
//a blob reference refers to the secure reference obtained from Blob#getReference()
//However in SegmentStore terminology a blob is referred via 'external reference'
@@ -248,20 +246,20 @@ public class SegmentNodeStore implements
"without specifying BlobStore");
}
- @Nonnull
+ @NotNull
@Override
- public String checkpoint(long lifetime, @Nonnull Map<String, String> properties) {
+ public String checkpoint(long lifetime, @NotNull Map<String, String> properties) {
return scheduler.checkpoint(lifetime, properties);
}
- @Override @Nonnull
+ @Override @NotNull
public synchronized String checkpoint(long lifetime) {
return checkpoint(lifetime, Collections.<String, String>emptyMap());
}
- @Nonnull
+ @NotNull
@Override
- public Map<String, String> checkpointInfo(@Nonnull String checkpoint) {
+ public Map<String, String> checkpointInfo(@NotNull String checkpoint) {
Map<String, String> properties = newHashMap();
checkNotNull(checkpoint);
NodeState cp = scheduler.getHeadNodeState()
@@ -276,14 +274,14 @@ public class SegmentNodeStore implements
return properties;
}
- @Nonnull
+ @NotNull
@Override
public Iterable<String> checkpoints() {
return getCheckpoints().getChildNodeNames();
}
- @Override @CheckForNull
- public NodeState retrieve(@Nonnull String checkpoint) {
+ @Override @Nullable
+ public NodeState retrieve(@NotNull String checkpoint) {
checkNotNull(checkpoint);
NodeState cp = scheduler.getHeadNodeState()
.getChildNode("checkpoints")
@@ -296,7 +294,7 @@ public class SegmentNodeStore implements
}
@Override
- public boolean release(@Nonnull String checkpoint) {
+ public boolean release(@NotNull String checkpoint) {
return scheduler.removeCheckpoint(checkpoint);
}
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStoreBuilders.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStoreBuilders.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/SegmentNodeStoreBuilders.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStoreBuilders.java Wed Nov 7 14:34:38 2018
@@ -19,12 +19,11 @@
package org.apache.jackrabbit.oak.segment;
-import javax.annotation.Nonnull;
-
import org.apache.jackrabbit.oak.segment.SegmentNodeStore.SegmentNodeStoreBuilder;
import org.apache.jackrabbit.oak.segment.file.FileStore;
import org.apache.jackrabbit.oak.segment.file.ReadOnlyFileStore;
import org.apache.jackrabbit.oak.segment.memory.MemoryStore;
+import org.jetbrains.annotations.NotNull;
/**
* Static factories for creating {@link SegmentNodeBuilder} instances
@@ -36,8 +35,8 @@ public final class SegmentNodeStoreBuild
/**
* Create a {@code SegmentNodeStoreBuilder} based on a {@code FileStore}.
*/
- @Nonnull
- public static SegmentNodeStoreBuilder builder(@Nonnull FileStore store) {
+ @NotNull
+ public static SegmentNodeStoreBuilder builder(@NotNull FileStore store) {
return SegmentNodeStore.builder(store.getRevisions(),
store.getReader(), store.getWriter(), store.getBlobStore());
}
@@ -45,8 +44,8 @@ public final class SegmentNodeStoreBuild
/**
* Create a {@code SegmentNodeStoreBuilder} based on a {@code MemoryStore}.
*/
- @Nonnull
- public static SegmentNodeStoreBuilder builder(@Nonnull MemoryStore store) {
+ @NotNull
+ public static SegmentNodeStoreBuilder builder(@NotNull MemoryStore store) {
return SegmentNodeStore.builder(store.getRevisions(),
store.getReader(), store.getWriter(), store.getBlobStore());
}
@@ -54,8 +53,8 @@ public final class SegmentNodeStoreBuild
/**
* Create a {@code SegmentNodeStoreBuilder} based on a {@code ReadOnlyFileStore@}.
*/
- @Nonnull
- public static SegmentNodeStoreBuilder builder(@Nonnull ReadOnlyFileStore store) {
+ @NotNull
+ public static SegmentNodeStoreBuilder builder(@NotNull ReadOnlyFileStore store) {
return SegmentNodeStore.builder(store.getRevisions(),
store.getReader(), store.getWriter(), store.getBlobStore());
}
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStoreService.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStoreService.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/SegmentNodeStoreService.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNodeStoreService.java Wed Nov 7 14:34:38 2018
@@ -78,9 +78,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
import com.google.common.base.Supplier;
import com.google.common.io.Closer;
import org.apache.felix.scr.annotations.Activate;
@@ -134,6 +131,8 @@ import org.apache.jackrabbit.oak.spi.whi
import org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardUtils;
import org.apache.jackrabbit.oak.stats.Clock;
import org.apache.jackrabbit.oak.stats.StatisticsProvider;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.osgi.framework.Constants;
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
@@ -404,11 +403,11 @@ public class SegmentNodeStoreService {
* @throws IOException In case an unrecoverable error occurs.
*/
static SegmentNodeStore registerSegmentStore(
- @Nonnull ComponentContext context,
+ @NotNull ComponentContext context,
@Nullable BlobStore blobStore,
- @Nonnull StatisticsProvider statisticsProvider,
- @Nonnull Closer closer,
- @Nonnull Whiteboard whiteboard,
+ @NotNull StatisticsProvider statisticsProvider,
+ @NotNull Closer closer,
+ @NotNull Whiteboard whiteboard,
@Nullable String role,
boolean descriptors
) throws IOException {
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNotFoundExceptionListener.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNotFoundExceptionListener.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/SegmentNotFoundExceptionListener.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentNotFoundExceptionListener.java Wed Nov 7 14:34:38 2018
@@ -19,8 +19,7 @@
package org.apache.jackrabbit.oak.segment;
-import javax.annotation.Nonnull;
-
+import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -35,7 +34,7 @@ public interface SegmentNotFoundExceptio
*/
SegmentNotFoundExceptionListener IGNORE_SNFE = new SegmentNotFoundExceptionListener() {
@Override
- public void notify(@Nonnull SegmentId id, @Nonnull SegmentNotFoundException snfe) { }
+ public void notify(@NotNull SegmentId id, @NotNull SegmentNotFoundException snfe) { }
};
/**
@@ -44,7 +43,7 @@ public interface SegmentNotFoundExceptio
SegmentNotFoundExceptionListener LOG_SNFE = new SegmentNotFoundExceptionListener() {
private final Logger log = LoggerFactory.getLogger(SegmentNotFoundExceptionListener.class);
@Override
- public void notify(@Nonnull SegmentId id, @Nonnull SegmentNotFoundException snfe) {
+ public void notify(@NotNull SegmentId id, @NotNull SegmentNotFoundException snfe) {
log.error("Segment not found: {}. {}", id, id.gcInfo(), snfe);
}
};
@@ -55,5 +54,5 @@ public interface SegmentNotFoundExceptio
* @param id the segment id of the offending {@code Segment}
* @param snfe the raised exception
*/
- void notify(@Nonnull final SegmentId id, @Nonnull final SegmentNotFoundException snfe);
+ void notify(@NotNull final SegmentId id, @NotNull final SegmentNotFoundException snfe);
}
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentParser.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/SegmentParser.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentParser.java Wed Nov 7 14:34:38 2018
@@ -35,12 +35,11 @@ import static org.apache.jackrabbit.oak.
import java.util.List;
-import javax.annotation.Nonnull;
-
import org.apache.jackrabbit.oak.api.Type;
import org.apache.jackrabbit.oak.spi.blob.BlobStore;
import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.jetbrains.annotations.NotNull;
/**
* {@code SegmentParser} serves as a base class for parsing segments.
@@ -257,10 +256,10 @@ public class SegmentParser {
}
}
- @Nonnull
+ @NotNull
private final SegmentReader reader;
- public SegmentParser(@Nonnull SegmentReader reader) {
+ public SegmentParser(@NotNull SegmentReader reader) {
this.reader = checkNotNull(reader);
}
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentPropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentPropertyState.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/SegmentPropertyState.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentPropertyState.java Wed Nov 7 14:34:38 2018
@@ -44,7 +44,6 @@ import static org.apache.jackrabbit.oak.
import java.util.List;
import java.util.Map;
-import javax.annotation.Nonnull;
import javax.jcr.PropertyType;
import org.apache.jackrabbit.oak.api.PropertyState;
@@ -52,6 +51,7 @@ import org.apache.jackrabbit.oak.api.Typ
import org.apache.jackrabbit.oak.plugins.memory.AbstractPropertyState;
import org.apache.jackrabbit.oak.plugins.value.Conversions;
import org.apache.jackrabbit.oak.plugins.value.Conversions.Converter;
+import org.jetbrains.annotations.NotNull;
/**
* A property, which can read a value or list record from a segment. It
@@ -61,25 +61,25 @@ import org.apache.jackrabbit.oak.plugins
* of type "LIST" (for arrays).
*/
public class SegmentPropertyState extends Record implements PropertyState {
- @Nonnull
+ @NotNull
private final SegmentReader reader;
- @Nonnull
+ @NotNull
private final String name;
- @Nonnull
+ @NotNull
private final Type<?> type;
- SegmentPropertyState(@Nonnull SegmentReader reader, @Nonnull RecordId id,
- @Nonnull String name, @Nonnull Type<?> type) {
+ SegmentPropertyState(@NotNull SegmentReader reader, @NotNull RecordId id,
+ @NotNull String name, @NotNull Type<?> type) {
super(id);
this.reader = checkNotNull(reader);
this.name = checkNotNull(name);
this.type = checkNotNull(type);
}
- SegmentPropertyState(@Nonnull SegmentReader reader, @Nonnull RecordId id,
- @Nonnull PropertyTemplate template) {
+ SegmentPropertyState(@NotNull SegmentReader reader, @NotNull RecordId id,
+ @NotNull PropertyTemplate template) {
this(reader, id, template.getName(), template.getType());
}
@@ -113,12 +113,12 @@ public class SegmentPropertyState extend
return map;
}
- @Override @Nonnull
+ @Override @NotNull
public String getName() {
return name;
}
- @Nonnull
+ @NotNull
@Override
public Type<?> getType() {
return type;
@@ -138,7 +138,7 @@ public class SegmentPropertyState extend
}
}
- @Override @Nonnull @SuppressWarnings("unchecked")
+ @Override @NotNull @SuppressWarnings("unchecked")
public <T> T getValue(Type<T> type) {
Segment segment = getSegment();
if (isArray()) {
@@ -172,7 +172,7 @@ public class SegmentPropertyState extend
return size(0);
}
- @Override @Nonnull
+ @Override @NotNull
public <T> T getValue(Type<T> type, int index) {
checkNotNull(type);
checkArgument(!type.isArray(), "Type must not be an array type");
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentReader.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/SegmentReader.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentReader.java Wed Nov 7 14:34:38 2018
@@ -19,7 +19,7 @@
package org.apache.jackrabbit.oak.segment;
-import javax.annotation.Nonnull;
+import org.jetbrains.annotations.NotNull;
/**
* Instances of {@code SegmentReader} are responsible for reading records from segments.
@@ -38,51 +38,51 @@ public interface SegmentReader {
* Read the string identified by {@code id}.
* @throws SegmentNotFoundException see class comment for exception semantics
*/
- @Nonnull
- String readString(@Nonnull RecordId id);
+ @NotNull
+ String readString(@NotNull RecordId id);
/**
* Read the map identified by {@code id}.
* @throws SegmentNotFoundException see class comment for exception semantics
*/
- @Nonnull
- MapRecord readMap(@Nonnull RecordId id);
+ @NotNull
+ MapRecord readMap(@NotNull RecordId id);
/**
* Read the template identified by {@code id}.
* @throws SegmentNotFoundException see class comment for exception semantics
*/
- @Nonnull
- Template readTemplate(@Nonnull RecordId id);
+ @NotNull
+ Template readTemplate(@NotNull RecordId id);
/**
* Read the node identified by {@code id}.
* @throws SegmentNotFoundException see class comment for exception semantics
*/
- @Nonnull
- SegmentNodeState readNode(@Nonnull RecordId id);
+ @NotNull
+ SegmentNodeState readNode(@NotNull RecordId id);
/**
* Read the current head state based on the head of {@code revisions}
* @param revisions
* @throws SegmentNotFoundException see class comment for exception semantics
*/
- @Nonnull
- SegmentNodeState readHeadState(@Nonnull Revisions revisions);
+ @NotNull
+ SegmentNodeState readHeadState(@NotNull Revisions revisions);
/**
* Read the property identified by {@code id} and {@code template}
* @throws SegmentNotFoundException see class comment for exception semantics
*/
- @Nonnull
+ @NotNull
SegmentPropertyState readProperty(
- @Nonnull RecordId id,
- @Nonnull PropertyTemplate template);
+ @NotNull RecordId id,
+ @NotNull PropertyTemplate template);
/**
* Read the blob identified by {@code id}.
* @throws SegmentNotFoundException see class comment for exception semantics
*/
- @Nonnull
- SegmentBlob readBlob(@Nonnull RecordId id);
+ @NotNull
+ SegmentBlob readBlob(@NotNull RecordId id);
}
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentStore.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/SegmentStore.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentStore.java Wed Nov 7 14:34:38 2018
@@ -20,7 +20,7 @@ package org.apache.jackrabbit.oak.segmen
import java.io.IOException;
-import javax.annotation.Nonnull;
+import org.jetbrains.annotations.NotNull;
/**
* The backend storage interface used by the segment node store.
@@ -43,7 +43,7 @@ public interface SegmentStore {
/**
* @throws SegmentNotFoundException always
*/
- @Nonnull
+ @NotNull
@Override
public Segment readSegment(SegmentId segmentId) {
throw new SegmentNotFoundException(segmentId);
@@ -73,7 +73,7 @@ public interface SegmentStore {
* @param segmentId segment identifier
* @return identified segment, or a {@link SegmentNotFoundException} thrown if not found
*/
- @Nonnull
+ @NotNull
Segment readSegment(SegmentId segmentId);
/**
Modified: jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentStream.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentStream.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/SegmentStream.java (original)
+++ jackrabbit/oak/branches/1.8/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentStream.java Wed Nov 7 14:34:38 2018
@@ -28,12 +28,12 @@ import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.List;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-
import com.google.common.base.Charsets;
import com.google.common.io.ByteStreams;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
/**
* For reading any record of type "VALUE" as binary streams.
*/
@@ -41,7 +41,7 @@ public class SegmentStream extends Input
static final int BLOCK_SIZE = 1 << 12; // 4kB
- @CheckForNull
+ @Nullable
public static RecordId getRecordIdIfAvailable(
InputStream stream, SegmentStore store) {
if (stream instanceof SegmentStream) {
@@ -138,7 +138,7 @@ public class SegmentStream extends Input
}
@Override
- public int read(@Nonnull byte[] b, int off, int len) {
+ public int read(@NotNull byte[] b, int off, int len) {
checkNotNull(b);
checkPositionIndexes(off, off + len, b.length);