Skip to content
This repository has been archived by the owner on Oct 20, 2020. It is now read-only.

Commit

Permalink
Rename variable for better understanding
Browse files Browse the repository at this point in the history
  • Loading branch information
gitanuj committed May 15, 2016
1 parent 9aa1ecc commit 8550669
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions rocky-raft/src/rocky/raft/log/RaftLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<LogEntry> getAll(int fromIndex) throws IOException {
public List<LogEntry> getAll(int fromLogEntryIndex) throws IOException {
Gson gson = new Gson();
List<LogEntry> logEntryList = new ArrayList<>();

Expand All @@ -82,7 +82,7 @@ public List<LogEntry> 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];
Expand Down

0 comments on commit 8550669

Please sign in to comment.