Search in sources :

Example 1 with ArchaiusConnectionPoolConfiguration

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;
}
Also used : DynoJedisClient(com.netflix.dyno.jedis.DynoJedisClient) ArchaiusConnectionPoolConfiguration(com.netflix.dyno.contrib.ArchaiusConnectionPoolConfiguration)

Example 2 with ArchaiusConnectionPoolConfiguration

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"));
}
Also used : DynoJedisClient(com.netflix.dyno.jedis.DynoJedisClient) ArchaiusConnectionPoolConfiguration(com.netflix.dyno.contrib.ArchaiusConnectionPoolConfiguration) DynomiteNodeInfo(com.github.diegopacheco.dynomite.cluster.checker.parser.DynomiteNodeInfo) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

ArchaiusConnectionPoolConfiguration (com.netflix.dyno.contrib.ArchaiusConnectionPoolConfiguration)2 DynoJedisClient (com.netflix.dyno.jedis.DynoJedisClient)2 DynomiteNodeInfo (com.github.diegopacheco.dynomite.cluster.checker.parser.DynomiteNodeInfo)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1