Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Commit

Permalink
Call close() in JournalChannel.java.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunny-Island committed Aug 26, 2021
1 parent 3cace12 commit a3cea19
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,14 @@ private JournalChannel(File journalDirectory, long logId,
this.configuration = configuration;

File fn = new File(journalDirectory, Long.toHexString(logId) + ".txn");
FileChannelProvider provider = FileChannelProvider.newProvider(configuration.getJournalChannelProvider());
channel = provider.open(fn, configuration);
try {
FileChannelProvider provider = FileChannelProvider.newProvider(configuration.getJournalChannelProvider());
channel = provider.open(fn, configuration);
} catch (IOException e){
LOG.error("Error when open BookieFileChannel from FileChannelProvider.", e);
throw e;
}


if (formatVersionToWrite < V4) {
throw new IOException("Invalid journal format to write : version = " + formatVersionToWrite);
Expand Down Expand Up @@ -275,9 +281,6 @@ public void close() throws IOException {
if (bc != null) {
bc.close();
}
if (channel != null) {
channel.close();
}
}

public void forceWrite(boolean forceMetadata) throws IOException {
Expand Down

0 comments on commit a3cea19

Please sign in to comment.