当前位置: 首页>>代码示例>>Java>>正文


Java Builder.addContactPoints方法代码示例

本文整理汇总了Java中com.datastax.driver.core.Cluster.Builder.addContactPoints方法的典型用法代码示例。如果您正苦于以下问题:Java Builder.addContactPoints方法的具体用法?Java Builder.addContactPoints怎么用?Java Builder.addContactPoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.datastax.driver.core.Cluster.Builder的用法示例。


在下文中一共展示了Builder.addContactPoints方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCluster

import com.datastax.driver.core.Cluster.Builder; //导入方法依赖的package包/类
protected Cluster getCluster()
{
    Builder cb = Cluster.builder();
    cb.addContactPoints(contactPoints);
    cb.withPort(getPort());

    if (getDataCenter() != null)
    {
        cb.withLoadBalancingPolicy(new DCAwareRoundRobinPolicy(getDataCenter()));
    }

    enrichCluster(cb);
    return cb.build();
}
 
开发者ID:PearsonEducation,项目名称:Docussandra,代码行数:15,代码来源:CassandraConfig.java

示例2: open

import com.datastax.driver.core.Cluster.Builder; //导入方法依赖的package包/类
public void open() {
    if ( cluster == null || session == null ) {
        Builder builder = Cluster.builder();
        builder.addContactPoints( hosts );
        if ( user != null && pass != null && !user.isEmpty() && !pass.isEmpty() ) {
            builder = builder.withCredentials( user, pass );
        }
        cluster = builder.build();
        session = cluster.connect( keyspace );
    }
}
 
开发者ID:Tetha,项目名称:bifroest,代码行数:12,代码来源:CassandraDatabase.java

示例3: create

import com.datastax.driver.core.Cluster.Builder; //导入方法依赖的package包/类
@Override
public DataContext create(DataContextProperties properties, ResourceFactoryRegistry resourceFactoryRegistry)
        throws UnsupportedDataContextPropertiesException, ConnectionException {

    final Map<String, Object> map = properties.toMap();
    final Builder clusterBuilder = Cluster.builder();

    final String hostname = properties.getHostname();
    if (!Strings.isNullOrEmpty(hostname)) {
        clusterBuilder.addContactPoints(hostname.split(","));
    }

    if (properties.getPort() != null) {
        clusterBuilder.withPort(properties.getPort());
    }

    if (map.containsKey("cluster-name")) {
        clusterBuilder.withClusterName((String) map.get("cluster-name"));
    }

    if (properties.getUsername() != null && properties.getPassword() != null) {
        clusterBuilder.withCredentials(properties.getUsername(), properties.getPassword());
    }

    final Cluster cluster = clusterBuilder.build();

    final String keySpace = getString(map.get("keyspace"), properties.getDatabaseName());

    return new CassandraDataContext(cluster, keySpace, properties.getTableDefs());
}
 
开发者ID:apache,项目名称:metamodel,代码行数:31,代码来源:CassandraDataContextFactory.java


注:本文中的com.datastax.driver.core.Cluster.Builder.addContactPoints方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。