Skip to content

Commit ee42844

Browse files
committed
fix#582: Review comments implemented
1 parent 22c6419 commit ee42844

File tree

1 file changed

+3
-35
lines changed

1 file changed

+3
-35
lines changed

bundles/sirix-core/src/main/java/org/sirix/io/combined/CombinedStorageWriter.java

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -31,61 +31,29 @@ public CombinedStorageWriter(Writer localWriter, Writer remoteWriter, Reader sto
3131
@Override
3232
public Writer write(PageReadOnlyTrx pageReadOnlyTrx, PageReference pageReference, Bytes<ByteBuffer> bufferedBytes) {
3333
Writer writer = localStorageWriter.write(pageReadOnlyTrx, pageReference, bufferedBytes);
34-
CompletableFuture<Writer> remoteWriterTask = CompletableFuture.supplyAsync(() -> remoteStorageWriter.write(pageReadOnlyTrx, pageReference, bufferedBytes));
35-
if (writer == null) {
36-
try {
37-
writer = remoteWriterTask.get();
38-
} catch (InterruptedException | ExecutionException e) {
39-
LOGGER.error("Could not complete remote write operation, please check the error details");
40-
e.printStackTrace();
41-
}
42-
}
34+
CompletableFuture.supplyAsync(() -> remoteStorageWriter.write(pageReadOnlyTrx, pageReference, bufferedBytes));
4335
return writer;
4436
}
4537

4638
@Override
4739
public Writer writeUberPageReference(PageReadOnlyTrx pageReadOnlyTrx, PageReference pageReference,
4840
Bytes<ByteBuffer> bufferedBytes) {
4941
Writer writer = localStorageWriter.writeUberPageReference(pageReadOnlyTrx, pageReference, bufferedBytes);
50-
CompletableFuture<Writer> remoteWriterTask = CompletableFuture.supplyAsync(() -> remoteStorageWriter.writeUberPageReference(pageReadOnlyTrx, pageReference, bufferedBytes));
51-
if (writer == null) {
52-
try {
53-
writer = remoteWriterTask.get();
54-
} catch (InterruptedException | ExecutionException e) {
55-
LOGGER.error("Could not complete remote write operation, please check the error details");
56-
e.printStackTrace();
57-
}
58-
}
42+
CompletableFuture.supplyAsync(() -> remoteStorageWriter.writeUberPageReference(pageReadOnlyTrx, pageReference, bufferedBytes));
5943
return writer;
6044
}
6145

6246
@Override
6347
public Writer truncateTo(PageReadOnlyTrx pageReadOnlyTrx, int revision) {
6448
Writer writer = localStorageWriter.truncateTo(pageReadOnlyTrx, revision);
65-
CompletableFuture<Writer> remoteWriterTask = CompletableFuture.supplyAsync(() -> remoteStorageWriter.truncateTo(pageReadOnlyTrx, revision));
66-
if (writer == null) {
67-
try {
68-
writer = remoteWriterTask.get();
69-
} catch (InterruptedException | ExecutionException e) {
70-
LOGGER.error("Could not complete remote write operation, please check the error details");
71-
e.printStackTrace();
72-
}
73-
}
49+
CompletableFuture.supplyAsync(() -> remoteStorageWriter.truncateTo(pageReadOnlyTrx, revision));
7450
return writer;
7551
}
7652

7753
@Override
7854
public Writer truncate() {
7955
Writer writer = localStorageWriter.truncate();
8056
CompletableFuture<Writer> remoteWriterTask = CompletableFuture.supplyAsync(() -> remoteStorageWriter.truncate());
81-
if (writer == null) {
82-
try {
83-
writer = remoteWriterTask.get();
84-
} catch (InterruptedException | ExecutionException e) {
85-
LOGGER.error("Could not complete remote write operation, please check the error details");
86-
e.printStackTrace();
87-
}
88-
}
8957
return writer;
9058
}
9159

0 commit comments

Comments
 (0)