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 md...@apache.org on 2016/05/17 09:35:03 UTC
svn commit: r1744225 - in
/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment:
SegmentWriter.java WriteOperationHandler.java
Author: mduerig
Date: Tue May 17 09:35:03 2016
New Revision: 1744225
URL: http://svn.apache.org/viewvc?rev=1744225&view=rev
Log:
@Trivial: Nullability annotations for SegmentWriter API and related
Modified:
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentWriter.java
jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriteOperationHandler.java
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentWriter.java?rev=1744225&r1=1744224&r2=1744225&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentWriter.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentWriter.java Tue May 17 09:35:03 2016
@@ -182,6 +182,7 @@ public class SegmentWriter {
writeOperationHandler.flush();
}
+ @Nonnull
MapRecord writeMap(final MapRecord base, final Map<String, RecordId> changes) throws IOException {
return new MapRecord(
writeOperationHandler.execute(new SegmentWriteOperation() {
@@ -192,6 +193,7 @@ public class SegmentWriter {
}));
}
+ @Nonnull
public RecordId writeList(final List<RecordId> list) throws IOException {
return writeOperationHandler.execute(new SegmentWriteOperation() {
@Override
@@ -201,6 +203,7 @@ public class SegmentWriter {
});
}
+ @Nonnull
public RecordId writeString(final String string) throws IOException {
return writeOperationHandler.execute(new SegmentWriteOperation() {
@Override
@@ -210,6 +213,7 @@ public class SegmentWriter {
});
}
+ @Nonnull
SegmentBlob writeBlob(final Blob blob) throws IOException {
return new SegmentBlob(
writeOperationHandler.execute(new SegmentWriteOperation() {
@@ -228,6 +232,7 @@ public class SegmentWriter {
* @param length number of bytes to write
* @return block record identifier
*/
+ @Nonnull
RecordId writeBlock(final byte[] bytes, final int offset, final int length) throws IOException {
return writeOperationHandler.execute(new SegmentWriteOperation() {
@Override
@@ -245,6 +250,7 @@ public class SegmentWriter {
* @return blob for the passed {@code stream}
* @throws IOException if the input stream could not be read or the output could not be written
*/
+ @Nonnull
public SegmentBlob writeStream(final InputStream stream) throws IOException {
return new SegmentBlob(
writeOperationHandler.execute(new SegmentWriteOperation() {
@@ -255,6 +261,7 @@ public class SegmentWriter {
}));
}
+ @Nonnull
SegmentPropertyState writeProperty(final PropertyState state) throws IOException {
RecordId id = writeOperationHandler.execute(new SegmentWriteOperation() {
@Override
@@ -299,7 +306,7 @@ public class SegmentWriter {
return with(writer).writeNode(state, 0);
}
}));
- } catch (SegmentWriteOperation.CancelledWriteException e) {
+ } catch (SegmentWriteOperation.CancelledWriteException ignore) {
return null;
}
}
Modified: jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriteOperationHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriteOperationHandler.java?rev=1744225&r1=1744224&r2=1744225&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriteOperationHandler.java (original)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/WriteOperationHandler.java Tue May 17 09:35:03 2016
@@ -21,6 +21,8 @@ package org.apache.jackrabbit.oak.segmen
import java.io.IOException;
+import javax.annotation.Nonnull;
+
/**
* A {@code WriteOperationHandler} executes {@link WriteOperation WriteOperation}s and as
* such serves as a bridge between {@link SegmentWriter} and {@link SegmentBufferWriter}.
@@ -41,7 +43,8 @@ interface WriteOperationHandler {
* @return {@code RecordId} that resulted from persisting the changes.
* @throws IOException
*/
- RecordId execute(SegmentBufferWriter writer) throws IOException;
+ @Nonnull
+ RecordId execute(@Nonnull SegmentBufferWriter writer) throws IOException;
}
/**
@@ -50,7 +53,8 @@ interface WriteOperationHandler {
* @return {@code RecordId} that resulted from persisting the changes.
* @throws IOException
*/
- RecordId execute(WriteOperation writeOperation) throws IOException;
+ @Nonnull
+ RecordId execute(@Nonnull WriteOperation writeOperation) throws IOException;
/**
* Flush any pending changes on any {@link SegmentBufferWriter} managed by this instance.