diff --git a/src/main/java/net/openhft/chronicle/map/AbstractChannelReplicator.java b/src/main/java/net/openhft/chronicle/map/AbstractChannelReplicator.java index cd08be0af..8877cb1fa 100644 --- a/src/main/java/net/openhft/chronicle/map/AbstractChannelReplicator.java +++ b/src/main/java/net/openhft/chronicle/map/AbstractChannelReplicator.java @@ -18,6 +18,7 @@ package net.openhft.chronicle.map; +import net.openhft.chronicle.core.Jvm; import net.openhft.chronicle.hash.impl.util.CloseablesManager; import net.openhft.chronicle.hash.replication.ThrottlingConfig; import net.openhft.chronicle.map.ReplicatedChronicleMap.BytesReplicatedContextFactory; @@ -150,7 +151,7 @@ abstract class AbstractChannelReplicator implements Closeable { * @return */ private static Selector openSelector(@NotNull final Selector selector, - @NotNull final SelectedSelectionKeySet selectedKeySet) { + @NotNull final SelectedSelectionKeySet selectedKeySet) { try { Class selectorImplClass = @@ -210,16 +211,12 @@ abstract class AbstractChannelReplicator implements Closeable { abstract void processEvent() throws IOException; final void start() { - future = executorService.submit( - new Runnable() { - @Override - public void run() { - try { - context = VanillaContext.get(BytesReplicatedContextFactory.INSTANCE); - processEvent(); - } catch (Exception e) { - LOG.error("", e); - } + future = executorService.submit(() -> { + try { + context = VanillaContext.get(BytesReplicatedContextFactory.INSTANCE); + processEvent(); + } catch (Exception e) { + LOG.error("", e); } } ); @@ -286,9 +283,7 @@ abstract class AbstractChannelReplicator implements Closeable { sb.append(lastThread); sb.append(" isAlive= "); sb.append(lastThread.isAlive()); - for (StackTraceElement ste : lastThread.getStackTrace()) { - sb.append("\n\t").append(ste); - } + Jvm.trimStackTrace(sb, lastThread.getStackTrace()); LOG.warn(sb.toString()); } } diff --git a/src/test/java/net/openhft/chronicle/map/ConstantSizeBySampleTest.java b/src/test/java/net/openhft/chronicle/map/ConstantSizeBySampleTest.java index 8cd0a1357..1d7a677b9 100644 --- a/src/test/java/net/openhft/chronicle/map/ConstantSizeBySampleTest.java +++ b/src/test/java/net/openhft/chronicle/map/ConstantSizeBySampleTest.java @@ -85,7 +85,7 @@ public class ConstantSizeBySampleTest { } } - @Test + @Test(expected = IllegalStateException.class) public void testUnexpectedlyLongConstantExternalizableValues() throws IOException { try ( ChronicleMap map = ChronicleMapBuilder.of(Long.class, ExternalizableData.class) @@ -111,7 +111,7 @@ public class ConstantSizeBySampleTest { } } - @Test + @Test(expected = IllegalStateException.class) public void testUnexpectedlyLongConstantSerializableValues() throws IOException { try ( ChronicleMap map = ChronicleMapBuilder.of(Long.class, SerializableData.class) diff --git a/src/test/java/net/openhft/chronicle/map/RecursiveRefereneChMapTest.java b/src/test/java/net/openhft/chronicle/map/RecursiveRefereneChMapTest.java index 790b84265..1704beb18 100644 --- a/src/test/java/net/openhft/chronicle/map/RecursiveRefereneChMapTest.java +++ b/src/test/java/net/openhft/chronicle/map/RecursiveRefereneChMapTest.java @@ -29,7 +29,7 @@ import static org.junit.Assert.assertSame; public class RecursiveRefereneChMapTest { public static final String TMP = System.getProperty("java.io.tmpdir"); - @Test + @Test(expected = IllegalStateException.class) public void testRecursive() throws IOException { File file = new File(TMP + "/test." + System.nanoTime() + ".tmp"); file.deleteOnExit(); diff --git a/src/test/java/net/openhft/chronicle/map/SingleMapChannelTest.java b/src/test/java/net/openhft/chronicle/map/SingleMapChannelTest.java index 0fac03146..bab8560f6 100644 --- a/src/test/java/net/openhft/chronicle/map/SingleMapChannelTest.java +++ b/src/test/java/net/openhft/chronicle/map/SingleMapChannelTest.java @@ -59,7 +59,7 @@ public class SingleMapChannelTest { { final TcpTransportAndNetworkConfig tcpConfig = TcpTransportAndNetworkConfig - .of(8086, new InetSocketAddress("localhost", 8087)) + .of(18086, new InetSocketAddress("localhost", 18087)) .autoReconnectedUponDroppedConnection(true) .heartBeatInterval(1, SECONDS); @@ -75,7 +75,7 @@ public class SingleMapChannelTest { { final TcpTransportAndNetworkConfig tcpConfig = TcpTransportAndNetworkConfig - .of(8087, new InetSocketAddress("localhost", 8086)) + .of(18087, new InetSocketAddress("localhost", 18086)) .autoReconnectedUponDroppedConnection(true) .heartBeatInterval(1, SECONDS); diff --git a/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java b/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java index eb2fc6299..8d34660f5 100644 --- a/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java +++ b/src/test/java/net/openhft/chronicle/map/StatelessClientTest.java @@ -24,6 +24,7 @@ import net.openhft.chronicle.hash.replication.SingleChronicleHashReplication; import net.openhft.chronicle.hash.replication.TcpTransportAndNetworkConfig; import net.openhft.lang.io.ByteBufferBytes; import net.openhft.lang.io.Bytes; +import net.openhft.lang.io.serialization.JDKZObjectSerializer; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -374,6 +375,8 @@ public class StatelessClientTest { try (ChronicleMap serverMap = ChronicleMapBuilder .of(String.class, Map.class) .entries(1000) + .averageValueSize(2000) + .objectSerializer(JDKZObjectSerializer.INSTANCE) .replication((byte) 2, TcpTransportAndNetworkConfig.of(8056)) .create()) { try (ChronicleMap statelessMap = localClient(8056)) {