Package com.netflix.astyanax.connectionpool

Examples of com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration


                    .build();
        }

        AstyanaxConfiguration configuration = new AstyanaxConfigurationImpl().setDiscoveryType(NodeDiscoveryType.NONE);

        ConnectionPoolConfiguration connectionPoolConfiguration = new ConnectionPoolConfigurationImpl("AstyanaxPool")
                .setPort(port)
                .setMaxConnsPerHost(1)
                .setSeeds(cassandraHostname + ":" + port);

        ConnectionPoolMonitor connectionPoolMonitor = new CountingConnectionPoolMonitor();
View Full Code Here


      throw new RuntimeException("Cannot use CqlFamilyFactory with a connection pool type other than ConnectionPoolType.JAVA_DRIVER");
    }

    ConnectionPoolProxy<?> cpProxy = (ConnectionPoolProxy<?>)cp;
   
    ConnectionPoolConfiguration jdConfig = getOrCreateJDConfiguration(asConfig, cpProxy.getConnectionPoolConfiguration());
    ConnectionPoolMonitor monitor = cpProxy.getConnectionPoolMonitor();
    if (monitor != null && (monitor instanceof CountingConnectionPoolMonitor))
      monitor = new JavaDriverConnectionPoolMonitorImpl();
    CqlKeyspaceImpl keyspace = new CqlKeyspaceImpl(ksName, asConfig, tracerFactory, jdConfig, monitor);
    cpProxy.addListener(keyspace);
View Full Code Here

    if (!(cp instanceof ConnectionPoolProxy)) {
      throw new RuntimeException("Cannot use CqlFamilyFactory with a connection pool type other than ConnectionPoolType.JAVA_DRIVER");
    }
   
    ConnectionPoolProxy<?> cpProxy = (ConnectionPoolProxy<?>)cp;
    ConnectionPoolConfiguration jdConfig = getOrCreateJDConfiguration(asConfig, cpProxy.getConnectionPoolConfiguration());
    ConnectionPoolMonitor monitor = cpProxy.getConnectionPoolMonitor();
    if (monitor != null && (monitor instanceof CountingConnectionPoolMonitor))
      monitor = new JavaDriverConnectionPoolMonitorImpl();
    CqlClusterImpl cluster = new CqlClusterImpl(asConfig, tracerFactory, jdConfig, monitor);
    ((ConnectionPoolProxy<Cluster>)cp).addListener(cluster);
View Full Code Here

    public void testAddHost() {
        Host host = new Host("127.0.0.1", TestHostType.GOOD_FAST.ordinal());

        CountingConnectionPoolMonitor monitor = new CountingConnectionPoolMonitor();

        ConnectionPoolConfiguration config = createConfig();
        SimpleHostConnectionPool<TestClient> pool = new SimpleHostConnectionPool<TestClient>(
                host, new TestConnectionFactory(config, monitor), monitor,
                config, new NoOpListener());
        Assert.assertEquals(0,      pool.getActiveConnectionCount());
        Assert.assertEquals(false,  pool.isReconnecting());
View Full Code Here

    @Test
    public void testAddHostWithCheckedException() {
        Host host = new Host("127.0.0.1",
                TestHostType.CONNECT_TIMEOUT.ordinal());

        ConnectionPoolConfiguration config = createConfig();
        CountingConnectionPoolMonitor monitor = new CountingConnectionPoolMonitor();
        SimpleHostConnectionPool<TestClient> pool = new SimpleHostConnectionPool<TestClient>(
                host, new TestConnectionFactory(config, monitor), monitor,
                config, new NoOpListener());
View Full Code Here

    @Test
    public void testAddHostWithUncheckedException() {
        Host host = new Host("127.0.0.1",
                TestHostType.CONNECT_WITH_UNCHECKED_EXCEPTION.ordinal());

        ConnectionPoolConfiguration config = createConfig();
        CountingConnectionPoolMonitor monitor = new CountingConnectionPoolMonitor();
        SimpleHostConnectionPool<TestClient> pool = new SimpleHostConnectionPool<TestClient>(
                host, new TestConnectionFactory(config, monitor), monitor,
                config, new NoOpListener());
View Full Code Here

    @Test
    public void testGrowConnections() {
        Host host = new Host("127.0.0.1", TestHostType.GOOD_FAST.ordinal());

        ConnectionPoolConfiguration config = createConfig();
        CountingConnectionPoolMonitor monitor = new CountingConnectionPoolMonitor();
        SimpleHostConnectionPool<TestClient> pool = new SimpleHostConnectionPool<TestClient>(
                host, new TestConnectionFactory(config, monitor), monitor,
                config, new NoOpListener());
View Full Code Here

    @Test
    public void testCloseOrReturnConnection() {
        Host host = new Host("127.0.0.1", TestHostType.GOOD_FAST.ordinal());

        ConnectionPoolConfiguration config = createConfig();
        CountingConnectionPoolMonitor monitor = new CountingConnectionPoolMonitor();
        SimpleHostConnectionPool<TestClient> pool = new SimpleHostConnectionPool<TestClient>(
                host, new TestConnectionFactory(config, monitor), monitor,
                config, new NoOpListener());
View Full Code Here

    private static Operation<TestClient, String> dummyOperation = new TestOperation();

    protected ConnectionPool<TestClient> createPool() {
        CountingConnectionPoolMonitor monitor = new CountingConnectionPoolMonitor();

        ConnectionPoolConfiguration config = new ConnectionPoolConfigurationImpl(
                TestConstants.CLUSTER_NAME + "_" + TestConstants.KEYSPACE_NAME);
        config.initialize();

        ConnectionPool<TestClient> pool = new RoundRobinConnectionPoolImpl<TestClient>(
                config, new TestConnectionFactory(config, monitor), monitor);

        return pool;
View Full Code Here

public class TokenAwareConnectionPoolTest extends BaseConnectionPoolTest {
    private static Logger LOG = LoggerFactory.getLogger(TokenAwareConnectionPoolTest.class);
    private static Operation<TestClient, String> dummyOperation = new TestOperation();

    protected ConnectionPool<TestClient> createPool() {
        ConnectionPoolConfiguration config = new ConnectionPoolConfigurationImpl(
                TestConstants.CLUSTER_NAME + "_" + TestConstants.KEYSPACE_NAME)
            .setPartitioner(OrderedBigIntegerPartitioner.get());
        config.initialize();

        CountingConnectionPoolMonitor monitor = new CountingConnectionPoolMonitor();

        return new TokenAwareConnectionPoolImpl<TestClient>(
                config, new TestConnectionFactory(config, monitor), monitor);
View Full Code Here

TOP

Related Classes of com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.