Code tidy a wider set of code.

This commit is contained in:
Peter Lawrey
2015-06-21 12:25:59 +01:00
parent 680182b129
commit 34c4cd8d32
32 changed files with 76 additions and 93 deletions
@@ -25,7 +25,7 @@ interface HashSplitting extends Serializable {
int segmentIndex(long hash);
long segmentHash(long hash);
static class Splitting {
class Splitting {
static HashSplitting forSegments(int segments) {
assert segments > 0;
if (segments == 1)
@@ -50,7 +50,7 @@ interface HashSplitting extends Serializable {
}
}
static class ForPowerOf2Segments implements HashSplitting {
class ForPowerOf2Segments implements HashSplitting {
private static final long serialVersionUID = 0L;
private final int mask;
@@ -73,7 +73,7 @@ interface HashSplitting extends Serializable {
}
//TODO optimize?
static class ForNonPowerOf2Segments implements HashSplitting {
class ForNonPowerOf2Segments implements HashSplitting {
private static final long serialVersionUID = 0L;
private static final int MASK = Integer.MAX_VALUE;
@@ -73,7 +73,7 @@ interface MultiMap {
void forEach(EntryConsumer action);
static interface EntryConsumer {
interface EntryConsumer {
void accept(long key, long value);
}
}
@@ -610,9 +610,8 @@ class AddressAndPort implements Comparable<AddressAndPort>, BytesMarshallable {
AddressAndPort that = (AddressAndPort) o;
if (port != that.port) return false;
if (!Arrays.equals(address, that.address)) return false;
return Arrays.equals(address, that.address);
return true;
}
@Override
@@ -890,9 +889,8 @@ class DiscoveryNodeBytesMarshallable implements BytesMarshallable {
ProposedNodes that = (ProposedNodes) o;
if (identifier != that.identifier) return false;
if (!addressAndPort.equals(that.addressAndPort)) return false;
return addressAndPort.equals(that.addressAndPort);
return true;
}
@Override
@@ -270,7 +270,7 @@ final class ReplicatedChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? supe
Object remoteRemove(K key,
final byte remoteIdentifier, long timeStamp) {
checkKey(key);
K key1 = (K) key;
K key1 = key;
ThreadLocalCopies copies = SegmentState.getCopies(null);
SegmentState segmentState = SegmentState.get(copies);
KI keyInterop = keyInteropProvider.get(copies, originalKeyInterop);
@@ -284,7 +284,7 @@ final class ReplicatedChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? supe
segment.writeLock();
try {
return segment.removeWithoutLock(copies, segmentState, metaKeyInterop, keyInterop, key1,
keySize, keyIdentity(), this, (V) null, valueIdentity(), segmentHash, this,
keySize, keyIdentity(), this, null, valueIdentity(), segmentHash, this,
removeReturnsNull, timeStamp, remoteIdentifier, true, false);
} finally {
segment.writeUnlock();
@@ -98,7 +98,7 @@ class StatelessChronicleMap<K, V> implements ChronicleMap<K, V>, Closeable, Clon
}
};
static enum EventId {
enum EventId {
HEARTBEAT,
STATEFUL_UPDATE,
LONG_SIZE,
@@ -551,7 +551,7 @@ class StatelessChronicleMap<K, V> implements ChronicleMap<K, V>, Closeable, Clon
final long sizeLocation = writeEventAnSkip(GET);
copies = writeKey((K) key);
copies = writeKey(key);
transactionId = send(sizeLocation, startTime);
} finally {
outBytesLock.unlock();
@@ -560,7 +560,7 @@ class StatelessChronicleMap<K, V> implements ChronicleMap<K, V>, Closeable, Clon
if (eventReturnsNull(GET))
return null;
return (V) readValue(transactionId, startTime, copies, usingValue);
return readValue(transactionId, startTime, copies, usingValue);
}
@@ -745,7 +745,7 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
"instance in the usual way.", e);
try {
return (T) aClass.newInstance();
return aClass.newInstance();
} catch (Exception e1) {
throw new IllegalStateException("It has not been possible to create a instance " +
"of class=" + aClass.getSimpleName() +
@@ -1022,7 +1022,7 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
@Override
public DelegatingMetaBytesInterop<Bytes, BytesInterop<Bytes>> getMetaValueInterop(
@NotNull ThreadLocalCopies copies, BytesInterop<Bytes> valueInterop, Bytes value) {
return DelegatingMetaBytesInterop.<Bytes, BytesInterop<Bytes>>instance();
return DelegatingMetaBytesInterop.instance();
}
@Override
@@ -113,5 +113,5 @@ interface BufferResizer {
* @param newCapacity
* @return the newly resize buffer
*/
public Bytes resizeBuffer(int newCapacity);
Bytes resizeBuffer(int newCapacity);
}