本文整理匯總了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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
}
示例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: 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;
}
示例10: initOpts
import com.datastax.driver.core.QueryOptions; //導入方法依賴的package包/類
@PostConstruct
public void initOpts(){
opts = new QueryOptions();
opts.setFetchSize(defaultFetchSize);
}
示例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);
}