Big refactoring of ReplicationDB to make it readable.
Changed count() return type from int to long.
Removed a useless parameter from ReplicationIterator ctor.
Various code cleanups in other classes.
ReplicationDB.java:
Extracted methods:
- intializeCounters() from ctor.
- insertCounterRecordIfNeeded() and newCounterRecord() from addEntries().
- toChangeNumber(byte[])
- getRegularRecord() from getPreviousChangeNumber().
- findFirstCounterRecordAfterStartPoint(), findFirstCounterRecordBeforeStopPoint() and computeDistance() from count().
Created method createReplicationKey() and moved ReplicationKey code there.
In readFirstChange(), readLastChange(), getPreviousChangeNumber(),
Renamed closeLockedCursor() to closeAndReleaseReadLock().
Renamed isaCounter() to isACounterRecord().
Changed count() return type from int to long.
ReplicationKey.java: REMOVED
Moved code to ReplicationDB.createReplicationKey().
ReplicationIterator.java
In ctor, removed unused parameter id.
DbHandler.java:
Consequence of the change to ReplicationIterator ctor.
Consequence of the change to ReplicationDB.count().
DbHandlerTest.java:
Consequence of the change to ReplicationDB.count().
Extracted methods configureReplicationServer(), getReplicationDbPath(), createDirectory(), assertFoundInOrder(), assertNotFound().
TestCaseUtils.java:
Added findFreePort(), findFreePorts().
bindFreePort() now delegates to bindPort().
ReplicationDbEnv.java:
Renamed local variables for increased readability.