@Override public void addHost(CassandraHost cassandraHost, boolean skipApplyConfig) { if (!skipApplyConfig && configurator != null) { configurator.applyConfig(cassandraHost); } connectionManager.addCassandraHost(cassandraHost); }
public CassandraHost[] buildCassandraHosts() { if (this.hosts == null) { throw new IllegalArgumentException("Need to define at least one host in order to apply configuration."); } String[] hostVals = hosts.split(","); CassandraHost[] cassandraHosts = new CassandraHost[hostVals.length]; for (int x=0; x<hostVals.length; x++) { CassandraHost cassandraHost = this.port == CassandraHost.DEFAULT_PORT ? new CassandraHost(hostVals[x].trim()) : new CassandraHost(hostVals[x], this.port); applyConfig(cassandraHost); cassandraHosts[x] = cassandraHost; } return cassandraHosts; }
/** * Find any nodes that are not already in the connection manager but are in * the cassandra ring and add them */ public void doAddNodes() { if (log.isDebugEnabled()) { log.debug("Node discovery running..."); } Set<CassandraHost> foundHosts = discoverNodes(); if (foundHosts != null && foundHosts.size() > 0) { log.info("Found {} new host(s) in Ring", foundHosts.size()); for (CassandraHost cassandraHost : foundHosts) { log.info("Addding found host {} to pool", cassandraHost); cassandraHostConfigurator.applyConfig(cassandraHost); connectionManager.addCassandraHost(cassandraHost); } } if (log.isDebugEnabled()) { log.debug("Node discovery run complete."); } }
HClientPool pool = null; try { cassandraHostConfigurator.applyConfig(cassandraHost); pool = cassandraHostConfigurator.getLoadBalancingPolicy().createConnection(clientFactory, cassandraHost, monitor); hostPools.putIfAbsent(cassandraHost, pool);
@Override public void addHost(CassandraHost cassandraHost, boolean skipApplyConfig) { if (!skipApplyConfig && configurator != null) { configurator.applyConfig(cassandraHost); } connectionManager.addCassandraHost(cassandraHost); }
@Override public void addHost(CassandraHost cassandraHost, boolean skipApplyConfig) { if (!skipApplyConfig && configurator != null) { configurator.applyConfig(cassandraHost); } connectionManager.addCassandraHost(cassandraHost); }
@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()); }
public CassandraHost[] buildCassandraHosts() { if (this.hosts == null) { throw new IllegalArgumentException("Need to define at least one host in order to apply configuration."); } String[] hostVals = hosts.split(","); CassandraHost[] cassandraHosts = new CassandraHost[hostVals.length]; for (int x=0; x<hostVals.length; x++) { CassandraHost cassandraHost = this.port == CassandraHost.DEFAULT_PORT ? new CassandraHost(hostVals[x].trim()) : new CassandraHost(hostVals[x], this.port); applyConfig(cassandraHost); cassandraHosts[x] = cassandraHost; } return cassandraHosts; }
public CassandraHost[] buildCassandraHosts() { if (this.hosts == null) { throw new IllegalArgumentException("Need to define at least one host in order to apply configuration."); } String[] hostVals = hosts.split(","); CassandraHost[] cassandraHosts = new CassandraHost[hostVals.length]; for (int x=0; x<hostVals.length; x++) { CassandraHost cassandraHost = this.port == CassandraHost.DEFAULT_PORT ? new CassandraHost(hostVals[x].trim()) : new CassandraHost(hostVals[x], this.port); applyConfig(cassandraHost); cassandraHosts[x] = cassandraHost; } return cassandraHosts; }
public void doAddNodes() { if ( log.isDebugEnabled() ) { log.debug("Auto discovery service running..."); } Set<CassandraHost> foundHosts = discoverNodes(); if ( foundHosts != null && foundHosts.size() > 0 ) { log.info("Found {} new host(s) in Ring", foundHosts.size()); for (CassandraHost cassandraHost : foundHosts) { log.info("Addding found host {} to pool", cassandraHost); cassandraHostConfigurator.applyConfig(cassandraHost); connectionManager.addCassandraHost(cassandraHost); } } if ( log.isDebugEnabled() ) { log.debug("Auto discovery service run complete."); } }
/** * Find any nodes that are not already in the connection manager but are in * the cassandra ring and add them */ public void doAddNodes() { if (log.isDebugEnabled()) { log.debug("Node discovery running..."); } Set<CassandraHost> foundHosts = discoverNodes(); if (foundHosts != null && foundHosts.size() > 0) { log.info("Found {} new host(s) in Ring", foundHosts.size()); for (CassandraHost cassandraHost : foundHosts) { log.info("Addding found host {} to pool", cassandraHost); cassandraHostConfigurator.applyConfig(cassandraHost); connectionManager.addCassandraHost(cassandraHost); } } if (log.isDebugEnabled()) { log.debug("Node discovery run complete."); } }
HClientPool pool = null; try { cassandraHostConfigurator.applyConfig(cassandraHost); pool = cassandraHostConfigurator.getLoadBalancingPolicy().createConnection(clientFactory, cassandraHost, monitor); hostPools.putIfAbsent(cassandraHost, pool);
HClientPool pool = null; try { cassandraHostConfigurator.applyConfig(cassandraHost); pool = cassandraHostConfigurator.getLoadBalancingPolicy().createConnection(clientFactory, cassandraHost); hostPools.putIfAbsent(cassandraHost, pool);