本文整理匯總了Java中com.datastax.driver.core.QueryOptions.setSerialConsistencyLevel方法的典型用法代碼示例。如果您正苦於以下問題:Java QueryOptions.setSerialConsistencyLevel方法的具體用法?Java QueryOptions.setSerialConsistencyLevel怎麽用?Java QueryOptions.setSerialConsistencyLevel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.datastax.driver.core.QueryOptions
的用法示例。
在下文中一共展示了QueryOptions.setSerialConsistencyLevel方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configureQueryOptions
import com.datastax.driver.core.QueryOptions; //導入方法依賴的package包/類
private void configureQueryOptions() {
final String consistencyConfiguration = (String) configuration.get(TRIDENT_CASSANDRA_CONSISTENCY);
final String serialConsistencyConfiguration = (String) configuration.get(TRIDENT_CASSANDRA_SERIAL_CONSISTENCY);
final QueryOptions queryOptions = builder.getConfiguration().getQueryOptions();
if (StringUtils.isNotEmpty(consistencyConfiguration)) {
queryOptions.setConsistencyLevel(ConsistencyLevel.valueOf(consistencyConfiguration));
}
if (StringUtils.isNotEmpty(serialConsistencyConfiguration)) {
queryOptions.setSerialConsistencyLevel(ConsistencyLevel.valueOf(serialConsistencyConfiguration));
}
builder = builder.withQueryOptions(queryOptions);
}
示例2: configureQueryOptions
import com.datastax.driver.core.QueryOptions; //導入方法依賴的package包/類
/**
* Creates the query options for this factory.
*
* @param configuration the configuration.
* @return the query options for this factory.
*/
private QueryOptions configureQueryOptions(final Configuration<Map<String, Object>> configuration) {
final QueryOptions queryOptions = new QueryOptions();
queryOptions.setConsistencyLevel(
ConsistencyLevel.valueOf(
configuration.getParameter(
"consistency_level",
"ONE")));
queryOptions.setSerialConsistencyLevel(
ConsistencyLevel.valueOf(
configuration.getParameter(
"serial_consistency_level",
"ONE")));
queryOptions.setFetchSize(configuration.getParameter(
"fetch_size",
1000));
return queryOptions;
}
示例3: populateQueryOptions
import com.datastax.driver.core.QueryOptions; //導入方法依賴的package包/類
private Cluster.Builder populateQueryOptions(Properties properties, Cluster.Builder builder) {
String consistencyLevelProp = properties.getProperty(CassandraStoreParameters.CONSISTENCY_LEVEL);
String serialConsistencyLevelProp = properties.getProperty(CassandraStoreParameters.SERIAL_CONSISTENCY_LEVEL);
String fetchSize = properties.getProperty(CassandraStoreParameters.FETCH_SIZE);
QueryOptions options = new QueryOptions();
if (consistencyLevelProp != null) {
options.setConsistencyLevel(ConsistencyLevel.valueOf(consistencyLevelProp));
}
if (serialConsistencyLevelProp != null) {
options.setSerialConsistencyLevel(ConsistencyLevel.valueOf(serialConsistencyLevelProp));
}
if (fetchSize != null) {
options.setFetchSize(Integer.parseInt(fetchSize));
}
return builder.withQueryOptions(options);
}
示例4: populateQueryOptions
import com.datastax.driver.core.QueryOptions; //導入方法依賴的package包/類
private Builder populateQueryOptions(Map<String, String> properties, Builder builder) {
String consistencyLevelProp = properties.get(DBConstants.Cassandra.CONSISTENCY_LEVEL);
String serialConsistencyLevelProp = properties.get(DBConstants.Cassandra.SERIAL_CONSISTENCY_LEVEL);
String fetchSize = properties.get(DBConstants.Cassandra.FETCH_SIZE);
QueryOptions options = new QueryOptions();
if (consistencyLevelProp != null) {
options.setConsistencyLevel(ConsistencyLevel.valueOf(consistencyLevelProp));
}
if (serialConsistencyLevelProp != null) {
options.setSerialConsistencyLevel(ConsistencyLevel.valueOf(serialConsistencyLevelProp));
}
if (fetchSize != null) {
options.setFetchSize(Integer.parseInt(fetchSize));
}
return builder.withQueryOptions(options);
}
示例5: getQueryOptions
import com.datastax.driver.core.QueryOptions; //導入方法依賴的package包/類
private QueryOptions getQueryOptions(CassandraProperties properties) {
QueryOptions options = new QueryOptions();
if (properties.getConsistencyLevel() != null) {
options.setConsistencyLevel(properties.getConsistencyLevel());
}
if (properties.getSerialConsistencyLevel() != null) {
options.setSerialConsistencyLevel(properties.getSerialConsistencyLevel());
}
options.setFetchSize(properties.getFetchSize());
return options;
}
示例6: getQueryOptions
import com.datastax.driver.core.QueryOptions; //導入方法依賴的package包/類
private static QueryOptions getQueryOptions(CassandraProperties properties) {
QueryOptions options = new QueryOptions();
if (properties.getConsistencyLevel() != null) {
options.setConsistencyLevel(properties.getConsistencyLevel());
}
if (properties.getSerialConsistencyLevel() != null) {
options.setSerialConsistencyLevel(properties.getSerialConsistencyLevel());
}
options.setFetchSize(properties.getFetchSize());
return options;
}
示例7: getQueryOptions
import com.datastax.driver.core.QueryOptions; //導入方法依賴的package包/類
private QueryOptions getQueryOptions() {
QueryOptions options = new QueryOptions();
if (eventStoreConfig.getConsistencyLevel() != null) {
options.setConsistencyLevel(eventStoreConfig.getConsistencyLevel());
}
if (eventStoreConfig.getSerialConsistencyLevel() != null) {
options.setSerialConsistencyLevel(eventStoreConfig.getSerialConsistencyLevel());
}
options.setFetchSize(eventStoreConfig.getFetchSize());
return options;
}
示例8: getQueryOptions
import com.datastax.driver.core.QueryOptions; //導入方法依賴的package包/類
private QueryOptions getQueryOptions() {
QueryOptions options = new QueryOptions();
CassandraProperties properties = this.properties;
if (properties.getConsistencyLevel() != null) {
options.setConsistencyLevel(properties.getConsistencyLevel());
}
if (properties.getSerialConsistencyLevel() != null) {
options.setSerialConsistencyLevel(properties.getSerialConsistencyLevel());
}
options.setFetchSize(properties.getFetchSize());
return options;
}
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:13,代碼來源:CassandraAutoConfiguration.java
示例9: getClusterBuilder
import com.datastax.driver.core.QueryOptions; //導入方法依賴的package包/類
public Cluster.Builder getClusterBuilder() {
final List<InetSocketAddress> sockets = new ArrayList<InetSocketAddress>();
for (String host : hosts) {
if(StringUtils.contains(host, ":")) {
String hostParts [] = StringUtils.split(host, ":");
sockets.add(new InetSocketAddress(hostParts[0], Integer.valueOf(hostParts[1])));
LOG.debug("Connecting to [" + host + "] with port [" + hostParts[1] + "]");
} else {
sockets.add(new InetSocketAddress(host, ProtocolOptions.DEFAULT_PORT));
LOG.debug("Connecting to [" + host + "] with port [" + ProtocolOptions.DEFAULT_PORT + "]");
}
}
Cluster.Builder builder = Cluster.builder().addContactPointsWithPorts(sockets).withCompression(compression);
QueryOptions queryOptions = new QueryOptions();
queryOptions.setConsistencyLevel(clusterConsistencyLevel);
queryOptions.setSerialConsistencyLevel(serialConsistencyLevel);
builder = builder.withQueryOptions(queryOptions);
if (StringUtils.isNotEmpty(clusterName)) {
builder = builder.withClusterName(clusterName);
}
return builder;
}