當前位置: 首頁>>代碼示例>>Java>>正文


Java QueryOptions.setFetchSize方法代碼示例

本文整理匯總了Java中com.datastax.driver.core.QueryOptions.setFetchSize方法的典型用法代碼示例。如果您正苦於以下問題:Java QueryOptions.setFetchSize方法的具體用法?Java QueryOptions.setFetchSize怎麽用?Java QueryOptions.setFetchSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.datastax.driver.core.QueryOptions的用法示例。


在下文中一共展示了QueryOptions.setFetchSize方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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;
}
 
開發者ID:spaziocodice,項目名稱:jena-nosql,代碼行數:28,代碼來源:CassandraStorageLayerFactory.java

示例2: 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);
}
 
開發者ID:apache,項目名稱:gora,代碼行數:17,代碼來源:CassandraClient.java

示例3: 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);
}
 
開發者ID:wso2,項目名稱:carbon-data,代碼行數:17,代碼來源:CassandraConfig.java

示例4: 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;
}
 
開發者ID:ElectronicArmory,項目名稱:Armory,代碼行數:12,代碼來源:CassandraConfiguration.java

示例5: connect

import com.datastax.driver.core.QueryOptions; //導入方法依賴的package包/類
/**
 * Currently we connect just once and then reuse the connection.
 * We do not bother with closing the connection.
 *
 * It is normal to use one Session per DB. The Session is thread safe.
 */
private void connect() {

    if (cluster == null) {

        log.info("Connecting to Cassandra server on " + this.dbHost + " at port " + this.dbPort);

        // allow fetching as much data as present in the DB
        QueryOptions queryOptions = new QueryOptions();
        queryOptions.setFetchSize(Integer.MAX_VALUE);
        queryOptions.setConsistencyLevel(ConsistencyLevel.ONE);

        cluster = Cluster.builder()
                         .addContactPoint(this.dbHost)
                         .withPort(this.dbPort)
                         .withLoadBalancingPolicy(new TokenAwarePolicy(new RoundRobinPolicy()))
                         .withReconnectionPolicy(new ExponentialReconnectionPolicy(500, 30000))
                         .withQueryOptions(queryOptions)
                         .withCredentials(this.dbUser, this.dbPassword)
                         .build();

    }

    if (session == null) {

        log.info("Connecting to Cassandra DB with name " + this.dbName);
        session = cluster.connect(dbName);
    }
}
 
開發者ID:Axway,項目名稱:ats-framework,代碼行數:35,代碼來源:CassandraDbProvider.java

示例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;
}
 
開發者ID:xm-online,項目名稱:xm-gate,代碼行數:12,代碼來源:CassandraConfiguration.java

示例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;
}
 
開發者ID:kloiasoft,項目名稱:eventapis,代碼行數:12,代碼來源:CassandraSession.java

示例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: getReadQueryOptions

import com.datastax.driver.core.QueryOptions; //導入方法依賴的package包/類
private static QueryOptions getReadQueryOptions(Configuration conf)
{
    String CL = ConfigHelper.getReadConsistencyLevel(conf);
    Optional<Integer> fetchSize = getInputPageRowSize(conf);
    QueryOptions queryOptions = new QueryOptions();
    if (CL != null && !CL.isEmpty())
        queryOptions.setConsistencyLevel(com.datastax.driver.core.ConsistencyLevel.valueOf(CL));

    if (fetchSize.isPresent())
        queryOptions.setFetchSize(fetchSize.get());
    return queryOptions;
}
 
開發者ID:vcostet,項目名稱:cassandra-kmean,代碼行數:13,代碼來源:CqlConfigHelper.java

示例10: initOpts

import com.datastax.driver.core.QueryOptions; //導入方法依賴的package包/類
@PostConstruct
public void initOpts(){
    opts = new QueryOptions();
    opts.setFetchSize(defaultFetchSize);
}
 
開發者ID:osswangxining,項目名稱:iotplatform,代碼行數:6,代碼來源:CassandraQueryOptions.java

示例11: createCassandraSession

import com.datastax.driver.core.QueryOptions; //導入方法依賴的package包/類
@Singleton
@Provides
public static CassandraSession createCassandraSession(
        CassandraConnectorId connectorId,
        CassandraClientConfig config,
        JsonCodec<List<ExtraColumnMetadata>> extraColumnMetadataCodec)
{
    requireNonNull(config, "config is null");
    requireNonNull(extraColumnMetadataCodec, "extraColumnMetadataCodec is null");

    Cluster.Builder clusterBuilder = Cluster.builder();

    List<String> contactPoints = requireNonNull(config.getContactPoints(), "contactPoints is null");
    checkArgument(!contactPoints.isEmpty(), "empty contactPoints");
    clusterBuilder.addContactPoints(contactPoints.toArray(new String[contactPoints.size()]));

    clusterBuilder.withPort(config.getNativeProtocolPort());
    clusterBuilder.withReconnectionPolicy(new ExponentialReconnectionPolicy(500, 10000));
    clusterBuilder.withRetryPolicy(config.getRetryPolicy().getPolicy());

    SocketOptions socketOptions = new SocketOptions();
    socketOptions.setReadTimeoutMillis(Ints.checkedCast(config.getClientReadTimeout().toMillis()));
    socketOptions.setConnectTimeoutMillis(Ints.checkedCast(config.getClientConnectTimeout().toMillis()));
    if (config.getClientSoLinger() != null) {
        socketOptions.setSoLinger(config.getClientSoLinger());
    }
    clusterBuilder.withSocketOptions(socketOptions);

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

    QueryOptions options = new QueryOptions();
    options.setFetchSize(config.getFetchSize());
    options.setConsistencyLevel(config.getConsistencyLevel());
    clusterBuilder.withQueryOptions(options);

    return new CassandraSession(
            connectorId.toString(),
            clusterBuilder,
            config.getFetchSizeForPartitionKeySelect(),
            config.getLimitForPartitionKeySelect(),
            extraColumnMetadataCodec);
}
 
開發者ID:y-lan,項目名稱:presto,代碼行數:45,代碼來源:CassandraClientModule.java


注:本文中的com.datastax.driver.core.QueryOptions.setFetchSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。