diff --git a/docs/CM_Replication.adoc b/docs/CM_Replication.adoc index d2aa1ae46..ae4ce11a6 100755 --- a/docs/CM_Replication.adoc +++ b/docs/CM_Replication.adoc @@ -210,7 +210,7 @@ registerForReplication: { .. -# corresponding registration message from remote peer +== corresponding registration message from remote peer targetHostId: 1 registerForReplication: { receiverHostId: 2, @@ -221,7 +221,7 @@ registerForReplication: { .. -# accept replication connection +== accept replication connection targetHostId: 2 acceptingReplicationRequest: { acceptingHostId: 1 @@ -229,7 +229,7 @@ acceptingReplicationRequest: { .. -# encoded replication update sent to remote peer +== encoded replication update sent to remote peer targetHostId: 2 replicatedEntry: !!binary AYChq5LqwKXqFAFOEwAAAAAAAAD/////////fw== .... diff --git a/src/main/java/net/openhft/chronicle/hash/VanillaGlobalMutableState.java b/src/main/java/net/openhft/chronicle/hash/VanillaGlobalMutableState.java index 1dfe2f891..5ef99f0b5 100644 --- a/src/main/java/net/openhft/chronicle/hash/VanillaGlobalMutableState.java +++ b/src/main/java/net/openhft/chronicle/hash/VanillaGlobalMutableState.java @@ -29,7 +29,7 @@ import net.openhft.chronicle.values.Values; */ public interface VanillaGlobalMutableState extends Byteable { - public static void main(String[] args) { + static void main(String[] args) { System.setProperty("chronicle.values.dumpCode", "true"); Values.nativeClassFor(VanillaGlobalMutableState.class); } diff --git a/src/main/java/net/openhft/chronicle/hash/impl/ChronicleHashCloseOnExitHook.java b/src/main/java/net/openhft/chronicle/hash/impl/ChronicleHashCloseOnExitHook.java index 8c8a3601a..9dfe04fff 100644 --- a/src/main/java/net/openhft/chronicle/hash/impl/ChronicleHashCloseOnExitHook.java +++ b/src/main/java/net/openhft/chronicle/hash/impl/ChronicleHashCloseOnExitHook.java @@ -29,12 +29,7 @@ final class ChronicleHashCloseOnExitHook { private static long order = 0; static { - Runtime.getRuntime().addShutdownHook(new Thread() { - @Override - public void run() { - closeAll(); - } - }); + Runtime.getRuntime().addShutdownHook(new Thread(ChronicleHashCloseOnExitHook::closeAll)); } private ChronicleHashCloseOnExitHook() { diff --git a/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java b/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java index e969833ae..b502586ef 100644 --- a/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java +++ b/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java @@ -373,13 +373,16 @@ public abstract class VanillaChronicleHash(); - if (tierHashLookupSlotSize == 4) { - hashLookup = new IntCompactOffHeapLinearHashTable(this); - } else if (tierHashLookupSlotSize == 8) { - hashLookup = new LongCompactOffHeapLinearHashTable(this); - } else { - throw new AssertionError("hash lookup slot size could be 4 or 8, " + - tierHashLookupSlotSize + " observed"); + switch (tierHashLookupSlotSize) { + case 4: + hashLookup = new IntCompactOffHeapLinearHashTable(this); + break; + case 8: + hashLookup = new LongCompactOffHeapLinearHashTable(this); + break; + default: + throw new AssertionError("hash lookup slot size could be 4 or 8, " + + tierHashLookupSlotSize + " observed"); } identity = new Identity(); } diff --git a/src/main/java/net/openhft/chronicle/map/AbstractChronicleMap.java b/src/main/java/net/openhft/chronicle/map/AbstractChronicleMap.java index 9edae7fe7..ef2b3c3bd 100644 --- a/src/main/java/net/openhft/chronicle/map/AbstractChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/AbstractChronicleMap.java @@ -198,9 +198,7 @@ interface AbstractChronicleMap extends ChronicleMap { } return v != null && c.value().equals(c.context().wrapValueAsData(v)); }); - } catch (ClassCastException unused) { - return false; - } catch (NullPointerException unused) { + } catch (ClassCastException | NullPointerException unused) { return false; } } diff --git a/src/main/java/net/openhft/chronicle/map/ChronicleMapEntrySet.java b/src/main/java/net/openhft/chronicle/map/ChronicleMapEntrySet.java index ed031c0be..ba10fb999 100644 --- a/src/main/java/net/openhft/chronicle/map/ChronicleMapEntrySet.java +++ b/src/main/java/net/openhft/chronicle/map/ChronicleMapEntrySet.java @@ -43,9 +43,7 @@ class ChronicleMapEntrySet extends AbstractSet> { try { V v = map.get(e.getKey()); return v != null && v.equals(e.getValue()); - } catch (ClassCastException ex) { - return false; - } catch (NullPointerException ex) { + } catch (ClassCastException | NullPointerException ex) { return false; } } @@ -58,9 +56,7 @@ class ChronicleMapEntrySet extends AbstractSet> { Object key = e.getKey(); Object value = e.getValue(); return map.remove(key, value); - } catch (ClassCastException ex) { - return false; - } catch (NullPointerException ex) { + } catch (ClassCastException | NullPointerException ex) { return false; } } diff --git a/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java b/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java index 265c62d73..79952ccf3 100644 --- a/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/ReplicatedChronicleMap.java @@ -544,7 +544,7 @@ public class ReplicatedChronicleMap extends VanillaChronicleMap new CompiledReplicatedMapQueryContext(c, m), this); + CompiledReplicatedMapQueryContext::new, this); } /** @@ -575,7 +575,7 @@ public class ReplicatedChronicleMap extends VanillaChronicleMap new CompiledReplicatedMapIterationContext(c, m), this); + CompiledReplicatedMapIterationContext::new, this); } @Override diff --git a/src/main/java/net/openhft/chronicle/map/ReplicatedGlobalMutableState.java b/src/main/java/net/openhft/chronicle/map/ReplicatedGlobalMutableState.java index 965f78231..652db5b15 100644 --- a/src/main/java/net/openhft/chronicle/map/ReplicatedGlobalMutableState.java +++ b/src/main/java/net/openhft/chronicle/map/ReplicatedGlobalMutableState.java @@ -22,7 +22,7 @@ import net.openhft.chronicle.values.*; interface ReplicatedGlobalMutableState extends VanillaGlobalMutableState { - public static void main(String[] args) { + static void main(String[] args) { System.setProperty("chronicle.values.dumpCode", "true"); Values.nativeClassFor(ReplicatedGlobalMutableState.class); } diff --git a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java index 4fccacc6a..6fcb85672 100755 --- a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java @@ -342,7 +342,7 @@ public class VanillaChronicleMap // lambda is used instead of constructor reference because currently stage-compiler // has issues with parsing method/constructor refs. // TODO replace with constructor ref when stage-compiler is improved - (c, m) -> new CompiledMapQueryContext(c, m), this); + CompiledMapQueryContext::new, this); } final ChainingInterface i() { @@ -385,7 +385,7 @@ public class VanillaChronicleMap // lambda is used instead of constructor reference because currently stage-compiler // has issues with parsing method/constructor refs. // TODO replace with constructor ref when stage-compiler is improved - (c, m) -> new CompiledMapIterationContext(c, m), this); + CompiledMapIterationContext::new, this); } @Override