Code tidy after code inspections

This commit is contained in:
Peter Lawrey
2018-04-21 17:41:31 +01:00
parent 9323cf28a7
commit e7c7dd8975
9 changed files with 23 additions and 31 deletions
@@ -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);
}
@@ -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() {
@@ -373,13 +373,16 @@ public abstract class VanillaChronicleHash<K,
private void initOwnTransients() {
globalMutableState = createGlobalMutableState();
tierBulkOffsets = new ArrayList<>();
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();
}
@@ -198,9 +198,7 @@ interface AbstractChronicleMap<K, V> extends ChronicleMap<K, V> {
}
return v != null && c.value().equals(c.context().wrapValueAsData(v));
});
} catch (ClassCastException unused) {
return false;
} catch (NullPointerException unused) {
} catch (ClassCastException | NullPointerException unused) {
return false;
}
}
@@ -43,9 +43,7 @@ class ChronicleMapEntrySet<K, V> extends AbstractSet<Map.Entry<K, V>> {
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<K, V> extends AbstractSet<Map.Entry<K, V>> {
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;
}
}
@@ -544,7 +544,7 @@ public class ReplicatedChronicleMap<K, V, R> extends VanillaChronicleMap<K, V, R
// 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 CompiledReplicatedMapQueryContext<K, V, R>(c, m), this);
CompiledReplicatedMapQueryContext::new, this);
}
/**
@@ -575,7 +575,7 @@ public class ReplicatedChronicleMap<K, V, R> extends VanillaChronicleMap<K, V, R
// 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 CompiledReplicatedMapIterationContext<K, V, R>(c, m), this);
CompiledReplicatedMapIterationContext::new, this);
}
@Override
@@ -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);
}
@@ -342,7 +342,7 @@ public class VanillaChronicleMap<K, V, R>
// 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<K, V, R>(c, m), this);
CompiledMapQueryContext::new, this);
}
final ChainingInterface i() {
@@ -385,7 +385,7 @@ public class VanillaChronicleMap<K, V, R>
// 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<K, V, R>(c, m), this);
CompiledMapIterationContext::new, this);
}
@Override