jelmini commented on code in PR #800:
URL: https://github.com/apache/jackrabbit-oak/pull/800#discussion_r1052445924
##########
oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/tar/TarWriter.java:
##########
@@ -183,7 +183,14 @@ void flush() throws IOException {
}
if (doFlush) {
- archive.flush();
+ archive.flush(() -> {
+ try {
+ writeBinaryReferences();
+ writeGraph();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
Review Comment:
An alternative would be to declare a functional interface declaring an
`IOException`:
```java
interface OnFlushSuccessCallback {
void run() throws IOException;
}
```
Then use it instead of `Runnable`:
```java
default void flush(OnFlushSuccessCallback onSuccess) throws IOException
```
With this, no need to catch the `IOException` to wrap it in a
`RuntimeException` :
```java
archive.flush(() -> {
writeBinaryReferences();
writeGraph();
});
```
--
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]