public class QueryOptions extends Object
QueryOptions
allow tuning of various query options on a per-request
level. Only options that are set are applied to queries.Modifier and Type | Class and Description |
---|---|
static class |
QueryOptions.QueryOptionsBuilder
Builder for
QueryOptions . |
Constructor and Description |
---|
QueryOptions()
Creates new
QueryOptions . |
QueryOptions(com.datastax.driver.core.ConsistencyLevel consistencyLevel,
com.datastax.driver.core.policies.RetryPolicy retryPolicy)
|
Modifier and Type | Method and Description |
---|---|
static QueryOptions.QueryOptionsBuilder |
builder()
Create a new
QueryOptions.QueryOptionsBuilder . |
protected com.datastax.driver.core.ConsistencyLevel |
getConsistencyLevel() |
protected Integer |
getFetchSize() |
protected Long |
getReadTimeout() |
protected com.datastax.driver.core.policies.RetryPolicy |
getRetryPolicy() |
protected Boolean |
getTracing() |
void |
setConsistencyLevel(com.datastax.driver.core.ConsistencyLevel consistencyLevel)
Sets the driver
ConsistencyLevel . |
void |
setFetchSize(int fetchSize)
Sets the query fetch size for
ResultSet chunks. |
void |
setReadTimeout(long readTimeout)
Sets the read timeout in milliseconds.
|
void |
setRetryPolicy(com.datastax.driver.core.policies.RetryPolicy retryPolicy)
Sets the
RetryPolicy . |
void |
setTracing(boolean tracing)
Enables statement tracing.
|
public QueryOptions()
QueryOptions
.public QueryOptions(com.datastax.driver.core.ConsistencyLevel consistencyLevel, com.datastax.driver.core.policies.RetryPolicy retryPolicy)
consistencyLevel
- the consistency level, may be null.retryPolicy
- the retry policy, may be null.public static QueryOptions.QueryOptionsBuilder builder()
QueryOptions.QueryOptionsBuilder
.QueryOptions.QueryOptionsBuilder
.public void setConsistencyLevel(com.datastax.driver.core.ConsistencyLevel consistencyLevel)
ConsistencyLevel
. Setting both (ConsistencyLevel
and driver
ConsistencyLevel
) consistency levels is not supported.consistencyLevel
- the driver ConsistencyLevel
to set.protected com.datastax.driver.core.ConsistencyLevel getConsistencyLevel()
ConsistencyLevel
public void setRetryPolicy(com.datastax.driver.core.policies.RetryPolicy retryPolicy)
RetryPolicy
. Setting both (RetryPolicy
and driver RetryPolicy
) retry
policies is not supported.retryPolicy
- the driver RetryPolicy
to set.IllegalStateException
- if the RetryPolicy
is setprotected com.datastax.driver.core.policies.RetryPolicy getRetryPolicy()
RetryPolicy
public void setFetchSize(int fetchSize)
ResultSet
chunks.
The fetch size controls how much resulting rows will be retrieved simultaneously (the goal being to avoid loading too much results in memory for queries yielding large results). Please note that while value as low as 1 can be used, it is *highly* discouraged to use such a low value in practice as it will yield very poor performance.
fetchSize
- the number of rows to fetch per chunking request. To disable chunking of the result set, use
fetchSize == Integer.MAX_VALUE
. Negative values are not allowed.QueryOptions.getFetchSize()
,
Cluster.Builder.withQueryOptions(com.datastax.driver.core.QueryOptions)
protected Integer getFetchSize()
public void setReadTimeout(long readTimeout)
SocketOptions.getReadTimeoutMillis()
).readTimeout
- the read timeout in milliseconds. Negative values are not allowed. If it is 0
, the read
timeout will be disabled for this statement.SocketOptions.getReadTimeoutMillis()
,
Cluster.Builder.withSocketOptions(SocketOptions)
protected Long getReadTimeout()
public void setTracing(boolean tracing)
tracing
- true to enable statement tracing to the executed statements.protected Boolean getTracing()
Copyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.