@@ -31,61 +31,29 @@ public CombinedStorageWriter(Writer localWriter, Writer remoteWriter, Reader sto
31
31
@ Override
32
32
public Writer write (PageReadOnlyTrx pageReadOnlyTrx , PageReference pageReference , Bytes <ByteBuffer > bufferedBytes ) {
33
33
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 ));
43
35
return writer ;
44
36
}
45
37
46
38
@ Override
47
39
public Writer writeUberPageReference (PageReadOnlyTrx pageReadOnlyTrx , PageReference pageReference ,
48
40
Bytes <ByteBuffer > bufferedBytes ) {
49
41
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 ));
59
43
return writer ;
60
44
}
61
45
62
46
@ Override
63
47
public Writer truncateTo (PageReadOnlyTrx pageReadOnlyTrx , int revision ) {
64
48
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 ));
74
50
return writer ;
75
51
}
76
52
77
53
@ Override
78
54
public Writer truncate () {
79
55
Writer writer = localStorageWriter .truncate ();
80
56
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
- }
89
57
return writer ;
90
58
}
91
59
0 commit comments