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


Java Builder.withoutMetrics方法代码示例

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


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

示例1: create

import com.datastax.driver.core.Cluster.Builder; //导入方法依赖的package包/类
@Override
public Cluster create(CassandraServiceInfo serviceInfo,
		ServiceConnectorConfig serviceConnectorConfig) {

	Builder builder = Cluster.builder()
			.addContactPoints(serviceInfo.getContactPoints().toArray(new String[0]))
			.withPort(serviceInfo.getPort());

	if (StringUtils.hasText(serviceInfo.getUsername())) {
		builder.withCredentials(serviceInfo.getUsername(), serviceInfo.getPassword());
	}

	if (serviceConnectorConfig instanceof CassandraClusterConfig) {

		CassandraClusterConfig config = (CassandraClusterConfig) serviceConnectorConfig;

		if (config.getCompression() != null) {
			builder.withCompression(config.getCompression());
		}

		builder.withPoolingOptions(config.getPoolingOptions());
		builder.withSocketOptions(config.getSocketOptions());
		builder.withQueryOptions(config.getQueryOptions());
		builder.withNettyOptions(config.getNettyOptions());
		builder.withLoadBalancingPolicy(config.getLoadBalancingPolicy());
		builder.withReconnectionPolicy(config.getReconnectionPolicy());
		builder.withRetryPolicy(config.getRetryPolicy());
		builder.withProtocolVersion(config.getProtocolVersion());

		if (!config.isMetricsEnabled()) {
			builder.withoutMetrics();
		}

		if (!config.isJmxReportingEnabled()) {
			builder.withoutJMXReporting();
		}
	}

	return builder.build();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-connectors,代码行数:41,代码来源:CassandraClusterCreator.java

示例2: createBuilder

import com.datastax.driver.core.Cluster.Builder; //导入方法依赖的package包/类
public Builder createBuilder() {
    Builder builder = Cluster.builder();
    for (String address : contactPoints) {
        builder.addContactPoint(address);
    }
    builder.withCompression(compression);
    if (username != null && password != null) {
        builder.withCredentials(username, password);
    }
 
    if (reconnectionPolicy != null) {
        builder.withReconnectionPolicy(reconnectionPolicy);
    }

    if (retryPolicy != null) {
        builder.withRetryPolicy(retryPolicy);
    }
    builder.withPort(port);

    if (!jmxEnabled) {
        builder.withoutJMXReporting();
    }

    if (!metricsEnabled) {
        builder.withoutMetrics();
    }

    if (sslOptions != null) {
        builder.withSSL(sslOptions);
    }

    copyPoolingOptions(builder);

    SocketOptions opts = new SocketOptions();
    opts.setConnectTimeoutMillis(connectTimeoutMillis);
    opts.setReadTimeoutMillis(readTimeoutMillis);

    if (receiveBufferSize != null) {
        opts.setReceiveBufferSize(receiveBufferSize);
    }
    if (sendBufferSize != null) {
        opts.setSendBufferSize(sendBufferSize);
    }
    if (soLinger != null) {
        opts.setSoLinger(soLinger);
    }
    if (keepAlive != null) {
        opts.setKeepAlive(keepAlive);
    }
    if (reuseAddress != null) {
        opts.setReuseAddress(reuseAddress);
    }
    if (tcpNoDelay != null) {
        opts.setTcpNoDelay(tcpNoDelay);
    }

    builder.withSocketOptions(opts);
    return builder;
}
 
开发者ID:pulsarIO,项目名称:realtime-analytics,代码行数:60,代码来源:CassandraConfig.java

示例3: populateSettings

import com.datastax.driver.core.Cluster.Builder; //导入方法依赖的package包/类
private Builder populateSettings(Builder builder, Map<String, String> properties) throws DataServiceFault {
    String serversParam = properties.get(DBConstants.Cassandra.CASSANDRA_SERVERS);
    String[] servers = serversParam.split(",");
    for (String server : servers) {
        builder = builder.addContactPoint(server);
    }
    String portProp = properties.get(DBConstants.Cassandra.PORT);
    if (portProp != null) {
        builder = builder.withPort(Integer.parseInt(portProp));
    }
    String clusterNameProp = properties.get(DBConstants.Cassandra.CLUSTER_NAME);
    if (clusterNameProp != null) {
        builder = builder.withClusterName(clusterNameProp);
    }
    String compressionProp = properties.get(DBConstants.Cassandra.COMPRESSION);
    if (compressionProp != null) {
        builder = builder.withCompression(Compression.valueOf(compressionProp));
    }        
    builder = this.populateCredentials(properties, builder);        
    builder = this.populateLoadBalancingProp(properties, builder);          
    String enableJMXProp = properties.get(DBConstants.Cassandra.ENABLE_JMX_REPORTING);
    if (enableJMXProp != null) {
        if (!Boolean.parseBoolean(enableJMXProp)) {
            builder = builder.withoutJMXReporting();
        }
    }
    String enableMetricsProp = properties.get(DBConstants.Cassandra.ENABLE_METRICS);
    if (enableMetricsProp != null) {
        if (!Boolean.parseBoolean(enableMetricsProp)) {
            builder = builder.withoutMetrics();
        }
    }        
    builder = this.populatePoolingSettings(properties, builder);        
    String versionProp = properties.get(DBConstants.Cassandra.PROTOCOL_VERSION);
    if (versionProp != null) {
        builder = builder.withProtocolVersion(ProtocolVersion.fromInt(Integer.parseInt(versionProp)));
    }
    builder = this.populateQueryOptions(properties, builder);
    builder = this.populateReconnectPolicy(properties, builder);
    builder = this.populateRetrytPolicy(properties, builder);
    builder = this.populateSocketOptions(properties, builder);
    String enableSSLProp = properties.get(DBConstants.Cassandra.ENABLE_SSL);
    if (enableSSLProp != null) {
        if (Boolean.parseBoolean(enableSSLProp)) {
            builder = builder.withSSL();
        }
    }
    return builder;
}
 
开发者ID:wso2,项目名称:carbon-data,代码行数:50,代码来源:CassandraConfig.java


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