Package com.datastax.driver.core

Examples of com.datastax.driver.core.Cluster.connect()


        if (!persistenceMap.containsKey(keySpace)) {
            Cluster cluter = Cluster.builder().addContactPoints(host).build();
            Session session = cluter.connect();
            if (!keySpace.contains(keySpace)) {
                verifyKeySpace(keySpace, cluter.connect(), replicaStrategy, factor);
                keySpaces.add(keySpace);
            }
            persistenceMap.put(keySpace, new PersistenceSimpleImpl(session,
                    keySpace));
        }
View Full Code Here


        LOGGER.debug("Connected to cluster: {0}", metadata.getClusterName());
        for (Host host : metadata.getAllHosts()) {
            LOGGER.debug("Datacenter: {0}; Host: {1}; Rack: {2}", host.getDatacenter(), host.getAddress(), host.getRack());
        }

        session = cluster.connect();
        try {
            session.execute("CREATE KEYSPACE modeshape WITH replication "
                            + "= {'class':'SimpleStrategy', 'replication_factor':3};");
        } catch (AlreadyExistsException e) {
        }
View Full Code Here

        options.setFetchSize(fetchSize);
        options.setConsistencyLevel(consistencyLevel);
        clusterBuilder.withQueryOptions(options);

        Cluster cluster = clusterBuilder.build();
        Session session = cluster.connect();
        return new CassandraSession(connectorId.toString(), session, fetchSizeForPartitionKeySelect, limitForPartitionKeySelect);
    }
}
View Full Code Here

        final Cluster cluster = createCluster(hostname, cqlPort, parameters);

        createKeyspaceIfNeeded(cluster, keyspaceName, keyspaceDurableWrite);

        if (nativeSessionOnly) {
            REPOSITORY.addNewSessionToKeyspace(keyspaceName, cluster.connect(keyspaceName));
        } else {
            Session nativeSession = cluster.connect(keyspaceName);
            achillesParameters.put(ConfigurationParameters.NATIVE_SESSION, nativeSession);
            achillesParameters.put(ConfigurationParameters.KEYSPACE_NAME, keyspaceName);
            if (!achillesParameters.containsKey(ConfigurationParameters.FORCE_TABLE_CREATION)) {
View Full Code Here

        createKeyspaceIfNeeded(cluster, keyspaceName, keyspaceDurableWrite);

        if (nativeSessionOnly) {
            REPOSITORY.addNewSessionToKeyspace(keyspaceName, cluster.connect(keyspaceName));
        } else {
            Session nativeSession = cluster.connect(keyspaceName);
            achillesParameters.put(ConfigurationParameters.NATIVE_SESSION, nativeSession);
            achillesParameters.put(ConfigurationParameters.KEYSPACE_NAME, keyspaceName);
            if (!achillesParameters.containsKey(ConfigurationParameters.FORCE_TABLE_CREATION)) {
                achillesParameters.put(ConfigurationParameters.FORCE_TABLE_CREATION, true);
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.