cassandraHostConfigurator.setRetryDownedHosts(false); cassandraHostConfigurator.setRetryDownedHostsDelayInSeconds(retryDelay);
configurator.setMaxWaitTimeWhenExhausted(50); configurator.setMaxExhaustedTimeBeforeMarkingAsDown(0); configurator.setRetryDownedHosts(false);
protected void init(String clustername, String hosts, String username, String password, String keyspace) { CassandraHostConfigurator hostconfig = new CassandraHostConfigurator(hosts); hostconfig.setRetryDownedHosts(true); hostconfig.setRetryDownedHostsDelayInSeconds(5); hostconfig.setRetryDownedHostsQueueSize(-1); // no bounds this.cluster = HFactory.getOrCreateCluster(clustername, hostconfig); Map<String,String> credentials = new HashMap<String, String>(); if (username != null && username.length() > 0) { credentials.put("username", username); credentials.put("password", password); } this.keyspace = HFactory.createKeyspace( keyspace, cluster, new AllOneConsistencyLevelPolicy(), FailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE); }
@Test public void testOnHostRestored() throws InterruptedException { cassandraHostConfigurator = new CassandraHostConfigurator("127.0.0.1:9170"); cassandraHostConfigurator.setRetryDownedHostsDelayInSeconds(1); cassandraHostConfigurator.setRetryDownedHosts(true); connectionManager = new HConnectionManager(clusterName,cassandraHostConfigurator); final CassandraHost host = new CassandraHost("127.0.0.1", 9170); final boolean[] eventFired = {false}; connectionManager.addListener(listenerName, new ConnectionManagerEmptyListener() { @Override public void onHostRestored(CassandraHost cassandraHost) { assertEquals(cassandraHost, host); eventFired[0] = true; } }); connectionManager.markHostAsDown(host); Thread.sleep(1100); assertTrue(eventFired[0]); }
config.setRetryDownedHosts(configuration.getAttribute(RETRY_DOWNED_HOSTS, Boolean.TRUE));
@Test public void testMarkHostDownWithNoRetry() { cassandraHostConfigurator = new CassandraHostConfigurator("127.0.0.1:9170"); cassandraHostConfigurator.setRetryDownedHosts(false); connectionManager = new HConnectionManager(clusterName, cassandraHostConfigurator); new CassandraHost("127.0.0.1", 9170); HClient client = connectionManager.borrowClient(); connectionManager.markHostAsDown(client.getCassandraHost()); assertEquals(0,connectionManager.getActivePools().size()); }
cassandraHostConfigurator.setRetryDownedHosts(false); cassandraHostConfigurator.setRetryDownedHostsDelayInSeconds(retryDelay);
config.setRetryDownedHosts(configuration.getAttribute(RETRY_DOWNED_HOSTS, Boolean.TRUE));
cassandraHostConfigurator.setRetryDownedHosts(false); cassandraHostConfigurator.setRetryDownedHostsDelayInSeconds(retryDelay);
cassandraHostConfigurator.setRetryDownedHosts(false);