HCOLL-134 changed the default so that is does not autoReconnectedUponDroppedConnection, however it better if most of the test cases have this can you can guarantee that the server is ready to accept TCP/IP before the client.

This commit is contained in:
Rob Austin
2014-11-21 11:04:26 +00:00
parent a8479ee02f
commit ae26c293c7
12 changed files with 107 additions and 43 deletions
@@ -20,7 +20,10 @@ package net.openhft.chronicle.hash.replication;
import java.io.Serializable;
import java.net.InetSocketAddress;
import java.util.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import static java.util.Collections.unmodifiableSet;
@@ -40,6 +43,7 @@ public final class TcpTransportAndNetworkConfig implements Serializable {
private final ThrottlingConfig throttlingConfig;
private final long heartBeatInterval;
private final TimeUnit heartBeatIntervalUnit;
private String name = "(unknown)";
private TcpTransportAndNetworkConfig(int serverPort, Set<InetSocketAddress> endpoints,
int packetSize,
@@ -70,7 +74,7 @@ public final class TcpTransportAndNetworkConfig implements Serializable {
return new TcpTransportAndNetworkConfig(
serverPort, unmodifiableSet(new HashSet<InetSocketAddress>(endpoints)),
DEFAULT_PACKET_SIZE,
true, // autoReconnectedUponDroppedConnection
false, // autoReconnectedUponDroppedConnection
ThrottlingConfig.noThrottling(),
DEFAULT_HEART_BEAT_INTERVAL,
DEFAULT_HEART_BEAT_INTERVAL_UNIT);
@@ -131,6 +135,14 @@ public final class TcpTransportAndNetworkConfig implements Serializable {
return packetSize;
}
/**
* @param name the name used here is reflected in the Tcp Replicator and is typically used when debugging
*/
public TcpTransportAndNetworkConfig name(String name) {
this.name = name;
return this;
}
public TcpTransportAndNetworkConfig packetSize(int packetSize) {
if (packetSize <= 0)
throw new IllegalArgumentException();
@@ -181,7 +193,8 @@ public final class TcpTransportAndNetworkConfig implements Serializable {
@Override
public String toString() {
return "TcpReplicationConfig{" +
"serverPort=" + serverPort +
"name=" + name() +
", serverPort=" + serverPort +
", endpoints=" + endpoints +
", packetSize=" + packetSize +
", autoReconnectedUponDroppedConnection=" + autoReconnectedUponDroppedConnection +
@@ -190,4 +203,11 @@ public final class TcpTransportAndNetworkConfig implements Serializable {
", heartBeatIntervalUnit=" + heartBeatIntervalUnit +
'}';
}
/**
* @return the name of this configuration
*/
public String name() {
return this.name;
}
}