@Override public RaftPersistentConfiguration save() { try (final FileOutputStream os = new FileOutputStream(tmpFile)) { os.write(JSON_WRITER.writeValueAsBytes(configuration)); os.flush(); } catch (final IOException e) { throw new RuntimeException("Unable to write raft storage", e); } try { FileUtil.replace(tmpPath, path); } catch (final IOException e) { throw new RuntimeException("Unable to replace raft storage", e); } return this; }
@Override public RaftPersistentConfiguration save() { try (final FileOutputStream os = new FileOutputStream(tmpFile)) { os.write(JSON_WRITER.writeValueAsBytes(configuration)); os.flush(); } catch (final IOException e) { throw new RuntimeException("Unable to write raft storage", e); } try { FileUtil.replace(tmpPath, path); } catch (final IOException e) { throw new RuntimeException("Unable to replace raft storage", e); } return this; }