@Override public final void close() { if (open) { if (partitionCleaner != null) { partitionCleaner.halt(); partitionCleaner = null; } try { if (isCommitOnClose()) { commit(); purgeUnusedTempPartitions(txLog); } super.close(); if (writeLock != null) { LockManager.release(writeLock); writeLock = null; } if (discardTxtRaf != null) { try { discardSink.close(); discardTxtRaf.close(); } catch (IOException e) { LOGGER.warn("Failed to close discard file"); } } } catch (JournalException e) { throw new JournalRuntimeException(e); } } }