CassandraHostConfigurator implements Serializable { public void applyConfig(CassandraHost cassandraHost) { cassandraHost.setMaxActive(maxActive); cassandraHost.setLifo(lifo); cassandraHost.setMaxWaitTimeWhenExhausted(maxWaitTimeWhenExhausted); cassandraHost.setMaxExhaustedTimeBeforeMarkingAsDown(maxExhaustedTimeBeforeMarkingAsDown); cassandraHost.setUseThriftFramedTransport(useThriftFramedTransport); cassandraHost.setMaxFrameSize(maxFrameSize); cassandraHost.setUseSocketKeepalive(useSocketKeepalive); cassandraHost.setMaxConnectTimeMillis(maxConnectTimeMillis); cassandraHost.setMaxLastSuccessTimeMillis(maxLastSuccessTimeMillis); if (cassandraThriftSocketTimeout > 0) { cassandraHost.setCassandraThriftSocketTimeout(cassandraThriftSocketTimeout); } } CassandraHostConfigurator();  CassandraHostConfigurator(String hosts); CassandraHost[] buildCassandraHosts(); void applyConfig(CassandraHost cassandraHost); void setHosts(String hosts); void setMaxActive(int maxActive); void setMaxWaitTimeWhenExhausted(long maxWaitTimeWhenExhausted); void setMaxExhaustedTimeBeforeMarkingAsDown(long maxExhaustedTimeBeforeMarkingAsDown); void setCassandraThriftSocketTimeout(int cassandraThriftSocketTimeout); boolean getRetryDownedHosts(); void setRetryDownedHosts(boolean retryDownedHosts); void setRetryDownedHostsQueueSize(int retryDownedHostsQueueSize); int getRetryDownedHostsQueueSize(); void setRetryDownedHostsDelayInSeconds(int retryDownedHostsDelayInSeconds); int getRetryDownedHostsDelayInSeconds(); static void setClockResolution(String resolutionString); HOpTimer getOpTimer(); void setOpTimer(HOpTimer opTimer); @Override String toString(); boolean getLifo(); void setLifo(boolean lifo); int getPort(); void setPort(int port); void setUseThriftFramedTransport(boolean useThriftFramedTransport); void setMaxFrameSize(int maxFrameSize); static ClockResolution getClockResolution(); static void setClockResolution(ClockResolution clockResolution); boolean getAutoDiscoverHosts(); void setAutoDiscoverHosts(boolean autoDiscoverHosts); int getAutoDiscoveryDelayInSeconds(); void setAutoDiscoveryDelayInSeconds(int autoDiscoveryDelayInSeconds); void setAutoDiscoveryDataCenter(String dataCenter); void setAutoDiscoveryDataCenter(List<String> dataCenters); List<String> getAutoDiscoveryDataCenters(); LoadBalancingPolicy getLoadBalancingPolicy(); void setLoadBalancingPolicy(LoadBalancingPolicy loadBalancingPolicy); int getHostTimeoutCounter(); void setHostTimeoutCounter(int hostTimeoutCounter); int getHostTimeoutWindow(); void setHostTimeoutWindow(int hostTimeoutWindow); int getHostTimeoutSuspensionDurationInSeconds(); void setHostTimeoutSuspensionDurationInSeconds(int hostTimeoutSuspensionDurationInSeconds); int getHostTimeoutUnsuspendCheckDelay(); void setHostTimeoutUnsuspendCheckDelay(int hostTimeoutUnsuspendCheckDelay); boolean getUseHostTimeoutTracker(); void setUseHostTimeoutTracker(boolean useHostTimeoutTracker); boolean getRunAutoDiscoveryAtStartup(); void setRunAutoDiscoveryAtStartup(boolean runAutoDiscoveryAtStartup); boolean getUseSocketKeepalive(); void setUseSocketKeepalive(boolean useSocketKeepalive); void setClientFactoryClass(String cls); Class<? extends HClientFactory> getClientFactoryClass(); long getMaxConnectTimeMillis(); void setMaxConnectTimeMillis(long maxConnectTimeMillis); long getMaxLastSuccessTimeMillis(); void setMaxLastSuccessTimeMillis(long maxLastSuccessTimeMillis); static final ClockResolution DEF_CLOCK_RESOLUTION; }
@Test public void testApplyConfig() { CassandraHostConfigurator cassandraHostConfigurator = new CassandraHostConfigurator("localhost:9170"); cassandraHostConfigurator.setMaxActive(15); cassandraHostConfigurator.setMaxConnectTimeMillis(30000); cassandraHostConfigurator.setMaxLastSuccessTimeMillis(40000); CassandraHost extraHost = new CassandraHost("localhost:9171"); cassandraHostConfigurator.applyConfig(extraHost); assertEquals(15, extraHost.getMaxActive()); assertEquals(30000, extraHost.getMaxConnectTimeMillis()); assertEquals(40000, extraHost.getMaxLastSuccessTimeMillis()); }