Package com.impetus.client.cassandra.service

Examples of com.impetus.client.cassandra.service.CassandraHost


            keyspace = (String) props.get(PersistenceProperties.KUNDERA_KEYSPACE);
        }

        for (Host host : ((CassandraHostConfiguration) configuration).getCassandraHosts())
        {
            CassandraHost cassandraHost = (CassandraHost) host;
            String poolName = PelopsUtils.generatePoolName(cassandraHost.getHost(), cassandraHost.getPort(), keyspace);
            if (CassandraUtilities.verifyConnection(cassandraHost.getHost(), cassandraHost.getPort()))
            {
                Cluster cluster = new Cluster(cassandraHost.getHost(), new IConnection.Config(cassandraHost.getPort(),
                        true, -1, PelopsUtils.getAuthenticationRequest(cassandraHost.getUser(),
                                cassandraHost.getPassword())), false);

                if (logger.isInfoEnabled())
                {
                    logger.info("Initializing connection pool for keyspace {}, host {},port {}.", keyspace,
                            cassandraHost.getHost(), cassandraHost.getPort());
                }

                Policy policy = PelopsUtils.getPoolConfigPolicy(cassandraHost);

                // Add pool with specified policy. null means default operand
View Full Code Here


            if (iThriftPool != null)
            {
                Node[] nodes = ((CommonsBackedPool) iThriftPool).getCluster().getNodes();
                String host = nodes[0].getAddress();
                int thriftPort = ((CommonsBackedPool) iThriftPool).getCluster().getConnectionConfig().getThriftPort();
                CassandraHost cassandraHost = ((CassandraHostConfiguration) configuration).getCassandraHost(
                        nodes[0].getAddress(), ((CommonsBackedPool) pool).getCluster().getConnectionConfig()
                                .getThriftPort());
                if (cassandraHost.isTestOnBorrow())
                {
                    if (cassandraHost.isTestOnBorrow() && CassandraUtilities.verifyConnection(host, thriftPort))
                    {
                        // logger.info("Returning connection of {} :{} .",
                        // nodes[0].getAddress(), thriftPort);
                        return iThriftPool.getConnection();
                    }
View Full Code Here

            if (iThriftPool != null)
            {
                Node[] nodes = ((CommonsBackedPool) iThriftPool).getCluster().getNodes();
                String host = nodes[0].getAddress();
                int thriftPort = ((CommonsBackedPool) iThriftPool).getCluster().getConnectionConfig().getThriftPort();
                CassandraHost cassandraHost = ((CassandraHostConfiguration) configuration).getCassandraHost(
                        nodes[0].getAddress(), ((CommonsBackedPool) pool).getCluster().getConnectionConfig()
                                .getThriftPort());
                if (cassandraHost.isTestOnBorrow())
                {
                    if (cassandraHost.isTestOnBorrow() && CassandraUtilities.verifyConnection(host, thriftPort))
                    {
                        // logger.info("Returning mutator of {} :{} .",
                        // nodes[0].getAddress(), thriftPort);
                        return Pelops.createMutator(PelopsUtils.getPoolName(iThriftPool));
                    }
View Full Code Here

            if (iThriftPool != null)
            {
                Node[] nodes = ((CommonsBackedPool) iThriftPool).getCluster().getNodes();
                String host = nodes[0].getAddress();
                int thriftPort = ((CommonsBackedPool) iThriftPool).getCluster().getConnectionConfig().getThriftPort();
                CassandraHost cassandraHost = ((CassandraHostConfiguration) configuration).getCassandraHost(
                        nodes[0].getAddress(), ((CommonsBackedPool) pool).getCluster().getConnectionConfig()
                                .getThriftPort());
                if (cassandraHost.isTestOnBorrow())
                {
                    if (cassandraHost.isTestOnBorrow() && CassandraUtilities.verifyConnection(host, thriftPort))
                    {
                        // logger.info("Returning selector of {} :{} .",
                        // nodes[0].getAddress(), thriftPort);
                        return Pelops.createSelector(PelopsUtils.getPoolName(iThriftPool));
                    }
View Full Code Here

            if (iThriftPool != null)
            {
                Node[] nodes = ((CommonsBackedPool) iThriftPool).getCluster().getNodes();
                String host = nodes[0].getAddress();
                int thriftPort = ((CommonsBackedPool) iThriftPool).getCluster().getConnectionConfig().getThriftPort();
                CassandraHost cassandraHost = ((CassandraHostConfiguration) configuration).getCassandraHost(
                        nodes[0].getAddress(), ((CommonsBackedPool) pool).getCluster().getConnectionConfig()
                                .getThriftPort());
                if (cassandraHost.isTestOnBorrow())
                {
                    if (cassandraHost.isTestOnBorrow() && CassandraUtilities.verifyConnection(host, thriftPort))
                    {
                        logger.info("Returning row deletor of {} :{} .", nodes[0].getAddress(), thriftPort);
                        return Pelops.createRowDeletor(PelopsUtils.getPoolName(iThriftPool));
                    }
                    removePool(iThriftPool);
View Full Code Here

    {
        Pelops.removePool(PelopsUtils.getPoolName(pool));
        Node[] nodes = ((CommonsBackedPool) pool).getCluster().getNodes();
        logger.warn("{} :{}  host appears to be down, trying for next ", nodes, ((CommonsBackedPool) pool).getCluster()
                .getConnectionConfig().getThriftPort());
        CassandraHost cassandraHost = ((CassandraHostConfiguration) configuration).getCassandraHost(
                nodes[0].getAddress(), ((CommonsBackedPool) pool).getCluster().getConnectionConfig().getThriftPort());
        hostPools.remove(cassandraHost);
    }
View Full Code Here

     * @param port
     * @return
     */
    private ConnectionPool getNewPool(String host, int port)
    {
        CassandraHost cassandraHost = ((CassandraHostConfiguration) configuration).getCassandraHost(host, port);
        hostPools.remove(cassandraHost);

        if (cassandraHost.isRetryHost())
        {
            logger.warn("Scheduling node for future retry");
            ((CassandraRetryService) hostRetryService).add((CassandraHost) cassandraHost);
        }

View Full Code Here

TOP

Related Classes of com.impetus.client.cassandra.service.CassandraHost

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.