use of com.netflix.dyno.contrib.ArchaiusConnectionPoolConfiguration in project dynomite-cluster-checker by diegopacheco.
the class DCCConnectionManager method createCluster.
public static DynoJedisClient createCluster(String clusterName, final List<DynomiteNodeInfo> nodes) {
ConfigurationManager.getConfigInstance().setProperty("dyno." + clusterName + ".retryPolicy", "RetryNTimes:1:true");
DynoJedisClient dynoClient = new DynoJedisClient.Builder().withApplicationName(clusterName).withDynomiteClusterName(clusterName).withCPConfig(new ArchaiusConnectionPoolConfiguration(clusterName).withTokenSupplier(TokenMapSupplierFactory.build(nodes)).setMaxConnsPerHost(1).setRetryPolicyFactory(new RetryNTimes.RetryFactory(1, true))).withHostSupplier(HostSupplierFactory.build(nodes)).build();
return dynoClient;
}
use of com.netflix.dyno.contrib.ArchaiusConnectionPoolConfiguration in project dynomite-cluster-checker by diegopacheco.
the class SimpleConnectionTest method testConnection.
@Ignore
@Test
public /**
* Should have the same result(connectivity-like) as:
* ./gradlew execute -Dexec.args="127.0.0.1:8102:rack1:local-dc:100"
*/
void testConnection() {
String clusterName = "local-cluster";
DynomiteNodeInfo node = new DynomiteNodeInfo("127.0.0.1", "8102", "rack1", "local-dc", "100");
DynoJedisClient dynoClient = new DynoJedisClient.Builder().withApplicationName(DynomiteConfig.CLIENT_NAME).withDynomiteClusterName(clusterName).withCPConfig(new ArchaiusConnectionPoolConfiguration(DynomiteConfig.CLIENT_NAME).withTokenSupplier(toTokenMapSupplier(Arrays.asList(node))).setMaxConnsPerHost(1).setConnectTimeout(2000).setPoolShutdownDelay(0).setFailOnStartupIfNoHosts(true).setFailOnStartupIfNoHostsSeconds(2).setMaxTimeoutWhenExhausted(2000).setSocketTimeout(2000).setRetryPolicyFactory(new RetryNTimes.RetryFactory(1))).withHostSupplier(toHostSupplier(Arrays.asList(node))).build();
dynoClient.set("Z", "200");
System.out.println("Z: " + dynoClient.get("Z"));
}
Aggregations