+ public boolean append(ReplicatedLogEntry replicatedLogEntry) {
+ if (replicatedLogEntry.getIndex() > lastIndex()) {
+ journal.add(replicatedLogEntry);
+ dataSize += replicatedLogEntry.size();
+ return true;
+ } else {
+ LOG.warn("{}: Cannot append new entry - new index {} is not greater than the last index {}",
+ logContext, replicatedLogEntry.getIndex(), lastIndex(), new Exception("stack trace"));
+ return false;
+ }
+ }
+
+ @Override
+ public void increaseJournalLogCapacity(int amount) {
+ journal.ensureCapacity(journal.size() + amount);