mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Code tidy a wider set of code.
This commit is contained in:
@@ -33,7 +33,7 @@ public final class ChronicleHashErrorListeners {
|
||||
* We can add some configuration-on-the-first-call in the future.
|
||||
*/
|
||||
|
||||
private static enum LoggingErrorListener implements ChronicleHashErrorListener {
|
||||
private enum LoggingErrorListener implements ChronicleHashErrorListener {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
@@ -52,7 +52,7 @@ public final class ChronicleHashErrorListeners {
|
||||
}
|
||||
}
|
||||
|
||||
private static enum ThrowingErrorListener implements ChronicleHashErrorListener {
|
||||
private enum ThrowingErrorListener implements ChronicleHashErrorListener {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
|
||||
+2
-4
@@ -176,11 +176,9 @@ public final class TcpTransportAndNetworkConfig implements Serializable {
|
||||
if (endpoints != null ? !endpoints.equals(that.endpoints) : that.endpoints != null)
|
||||
return false;
|
||||
if (heartBeatIntervalUnit != that.heartBeatIntervalUnit) return false;
|
||||
if (throttlingConfig != null ? !throttlingConfig.equals(that.throttlingConfig) :
|
||||
that.throttlingConfig != null)
|
||||
return false;
|
||||
return !(throttlingConfig != null ? !throttlingConfig.equals(that.throttlingConfig) :
|
||||
that.throttlingConfig != null);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -21,5 +21,5 @@ import net.openhft.chronicle.hash.ChronicleHash;
|
||||
import java.util.Set;
|
||||
|
||||
public interface ChronicleSet<E> extends Set<E>, ChronicleHash {
|
||||
public long longSize();
|
||||
long longSize();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user