From 85506693b97db1c5a23fb59ecb1e7278f8ec05bd Mon Sep 17 00:00:00 2001 From: Tanuj Mittal Date: Sun, 15 May 2016 11:57:27 -0700 Subject: [PATCH] Rename variable for better understanding --- rocky-raft/src/rocky/raft/log/RaftLog.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rocky-raft/src/rocky/raft/log/RaftLog.java b/rocky-raft/src/rocky/raft/log/RaftLog.java index 04fe3df..3d8004a 100644 --- a/rocky-raft/src/rocky/raft/log/RaftLog.java +++ b/rocky-raft/src/rocky/raft/log/RaftLog.java @@ -59,20 +59,20 @@ public synchronized LogEntry last() throws IOException { } @Override - public synchronized LogEntry get(int index) throws IOException { - LogEntry logEntry = cache.get(index); + public synchronized LogEntry get(int logEntryIndex) throws IOException { + LogEntry logEntry = cache.get(logEntryIndex); if (logEntry == null) { - byte[] data = queueFile.get(index - 1); + byte[] data = queueFile.get(logEntryIndex - 1); if (data != null) { logEntry = new Gson().fromJson(new String(data), LogEntry.class); - cache.put(index, logEntry); + cache.put(logEntryIndex, logEntry); } } return logEntry; } @Override - public List getAll(int fromIndex) throws IOException { + public List getAll(int fromLogEntryIndex) throws IOException { Gson gson = new Gson(); List logEntryList = new ArrayList<>(); @@ -82,7 +82,7 @@ public List getAll(int fromIndex) throws IOException { @Override public boolean read(InputStream in, int length) throws IOException { ++current; - if (current >= fromIndex - 1) { + if (current >= fromLogEntryIndex - 1) { LogEntry entry = cache.get(current + 1); if (entry == null) { byte[] data = new byte[length];