diff --git a/src/main/java/net/openhft/chronicle/hash/replication/TcpInetSocketAddress.java b/src/main/java/net/openhft/chronicle/hash/replication/TcpInetSocketAddress.java new file mode 100644 index 000000000..cfd0c7fd5 --- /dev/null +++ b/src/main/java/net/openhft/chronicle/hash/replication/TcpInetSocketAddress.java @@ -0,0 +1,17 @@ +package net.openhft.chronicle.hash.replication; + +import java.net.InetSocketAddress; + +public class TcpInetSocketAddress extends InetSocketAddress { + private final String toString; + + public TcpInetSocketAddress(String hostname, int port) { + super(hostname, port); + toString = super.toString(); + } + + @Override + public String toString() { + return toString; + } +} diff --git a/src/main/java/net/openhft/chronicle/hash/replication/TcpTransportAndNetworkConfig.java b/src/main/java/net/openhft/chronicle/hash/replication/TcpTransportAndNetworkConfig.java index f75804f6d..a37a4a45d 100644 --- a/src/main/java/net/openhft/chronicle/hash/replication/TcpTransportAndNetworkConfig.java +++ b/src/main/java/net/openhft/chronicle/hash/replication/TcpTransportAndNetworkConfig.java @@ -70,8 +70,12 @@ public final class TcpTransportAndNetworkConfig implements Serializable { throw new IllegalArgumentException("endpoint=" + endpoint + " can not point to the same port as the server"); } + Set s = new HashSet<>(); + for (InetSocketAddress endpoint : endpoints) { + s.add(new TcpInetSocketAddress(endpoint.getHostName(), endpoint.getPort())); + } return new TcpTransportAndNetworkConfig( - serverPort, unmodifiableSet(new HashSet(endpoints)), + serverPort, unmodifiableSet(s), DEFAULT_PACKET_SIZE, false, // autoReconnectedUponDroppedConnection ThrottlingConfig.noThrottling(), diff --git a/src/main/java/net/openhft/chronicle/map/StatelessChronicleMap.java b/src/main/java/net/openhft/chronicle/map/StatelessChronicleMap.java index 2fd44961f..b1191f790 100644 --- a/src/main/java/net/openhft/chronicle/map/StatelessChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/StatelessChronicleMap.java @@ -1491,7 +1491,7 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon } - private R fetchObject(Class rClass, final EventId eventId, K key, V... values) { + private R fetchObject(Class rClass, final EventId eventId, K key, V value) { final long startTime = System.currentTimeMillis(); ThreadLocalCopies copies; @@ -1505,9 +1505,7 @@ class StatelessChronicleMap implements ChronicleMap, Closeable, Clon : writeEventAnSkip(eventId); copies = writeKey(key); - for (V value : values) { - copies = writeValue(value, copies); - } + copies = writeValue(value, copies); transactionId = blockingSend(sizeLocation, startTime); } finally { outBytesLock.unlock(); diff --git a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java index 94e93d4d7..2670bec71 100755 --- a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java @@ -1689,9 +1689,8 @@ class VanillaChronicleMap, return (int) (sizeInBytes / entrySize) + 1; } - private , RV> - RV acquire( - @Nullable ThreadLocalCopies copies, final @Nullable SegmentState segmentState, + , RV> + RV acquire(@Nullable ThreadLocalCopies copies, final @Nullable SegmentState segmentState, MKBI metaKeyInterop, KBI keyInterop, KB key, long keySize, InstanceOrBytesToInstance toKey, ReadValue readValue, RV usingValue, InstanceOrBytesToInstance toValue, diff --git a/src/test/java/eg/BGChronicleTest.java b/src/test/java/eg/BGChronicleTest.java index 6c728e6ae..d3a057ed5 100644 --- a/src/test/java/eg/BGChronicleTest.java +++ b/src/test/java/eg/BGChronicleTest.java @@ -23,12 +23,12 @@ public class BGChronicleTest { public static final int CHRONICLE_HEARTBEAT_SECONDS = 5; public static final int READ_RATIO = Integer.getInteger("readRatio", 2); - public static final int CLIENTS = Integer.getInteger("clients", Math.max(1, Runtime.getRuntime().availableProcessors() - 2)); + public static final int CLIENTS = Integer.getInteger("clients", Math.max(1, Runtime.getRuntime().availableProcessors() - 1)); // public static final boolean BUSY_WAIT = Boolean.parseBoolean(System.getProperty("busyWait", // "" + (CLIENTS < Runtime.getRuntime().availableProcessors()))); public static final int REPLICAS = Integer.getInteger("replicas", 1); public static final long KEYS = Long.getLong("keys", 100_000L); - public static final long MESSAGES = Long.getLong("messages", 100_000 + KEYS * 2); + public static final long MESSAGES = Long.getLong("messages", 1000_000 + KEYS * 10); public static final long MAX_RATE = Long.getLong("maxRate", 50000); public static final String DEFAULT_HOST = "localhost"; public static final int DEFAULT_PORT = 9050; @@ -235,15 +235,17 @@ public class BGChronicleTest { // if (BUSY_WAIT) // while (System.nanoTime() < next) ; // 100 possible values for the first byte. - long start = System.nanoTime(); + long start; key[0] = b; if (rnd.nextInt(READ_RATIO + 1) == 0) { // puts value[0] = b; + start = System.nanoTime(); map.put(key, value); } else { //gets + start = System.nanoTime(); map.get(key); } long time = System.nanoTime() - start;