jelmini commented on code in PR #692:
URL: https://github.com/apache/jackrabbit-oak/pull/692#discussion_r1050643260
##########
oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/SegmentBufferWriterPool.java:
##########
@@ -82,151 +62,292 @@ public class SegmentBufferWriterPool implements
WriteOperationHandler {
private short writerId = -1;
- public SegmentBufferWriterPool(
+ private SegmentBufferWriterPool(
@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);
+ this.idProvider = idProvider;
+ this.reader = reader;
+ this.wid = wid;
+ this.gcGeneration = gcGeneration;
}
- @Override
- @NotNull
- public GCGeneration getGCGeneration() {
- return gcGeneration.get();
+ public enum PoolType {
+ GLOBAL,
+ THREAD_SPECIFIC;
}
- @NotNull
- @Override
- public RecordId execute(@NotNull GCGeneration gcGeneration,
- @NotNull WriteOperation writeOperation)
- throws IOException {
- SimpleImmutableEntry<?,?> key = new
SimpleImmutableEntry<>(currentThread(), gcGeneration);
- SegmentBufferWriter writer = borrowWriter(key, gcGeneration);
- try {
- return writeOperation.execute(writer);
- } finally {
- returnWriter(key, writer);
+ public static class SegmentBufferWriterPoolFactory {
+ @NotNull
+ private final SegmentIdProvider idProvider;
+ @NotNull
+ private final SegmentReader reader;
+ @NotNull
+ private final String wid;
+ @NotNull
+ private final Supplier<GCGeneration> gcGeneration;
+
+ private SegmentBufferWriterPoolFactory(
+ @NotNull SegmentIdProvider idProvider,
+ @NotNull SegmentReader reader,
+ @NotNull String wid,
+ @NotNull Supplier<GCGeneration> gcGeneration) {
+ this.idProvider = checkNotNull(idProvider);
Review Comment:
Can be replaced by `Objects.requireNonNull`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]