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(ConsistencyLevel consistencyLevel,
RetryPolicy retryPolicy)
|
Modifier and Type | Method and Description |
---|---|
static QueryOptions.QueryOptionsBuilder |
builder()
Creates a new
QueryOptions.QueryOptionsBuilder . |
ConsistencyLevel |
getConsistencyLevel()
Deprecated.
|
protected com.datastax.driver.core.ConsistencyLevel |
getDriverConsistencyLevel() |
protected com.datastax.driver.core.policies.RetryPolicy |
getDriverRetryPolicy() |
protected Integer |
getFetchSize() |
protected Long |
getReadTimeout() |
RetryPolicy |
getRetryPolicy()
Returns the
RetryPolicy . |
protected Boolean |
getTracing() |
void |
setConsistencyLevel(ConsistencyLevel consistencyLevel)
Sets the driver
ConsistencyLevel . |
void |
setConsistencyLevel(com.datastax.driver.core.ConsistencyLevel driverConsistencyLevel)
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(RetryPolicy retryPolicy)
Sets the
RetryPolicy . |
void |
setRetryPolicy(com.datastax.driver.core.policies.RetryPolicy driverRetryPolicy)
Sets the
RetryPolicy . |
void |
setTracing(boolean tracing)
Enables statement tracing.
|
public QueryOptions()
QueryOptions
.public QueryOptions(ConsistencyLevel consistencyLevel, 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
.@Deprecated public ConsistencyLevel getConsistencyLevel()
setConsistencyLevel(com.datastax.driver.core.ConsistencyLevel)
ConsistencyLevel
.public void setConsistencyLevel(ConsistencyLevel consistencyLevel)
ConsistencyLevel
. Setting both (ConsistencyLevel
and
driver ConsistencyLevel
) consistency levels is not supported.consistencyLevel
- the consistencyLevel to set.IllegalStateException
- if the driver ConsistencyLevel
is
setpublic void setConsistencyLevel(com.datastax.driver.core.ConsistencyLevel driverConsistencyLevel)
ConsistencyLevel
. Setting both (ConsistencyLevel
and
driver ConsistencyLevel
) consistency levels is not supported.driverConsistencyLevel
- the driver ConsistencyLevel
to set.IllegalStateException
- if the ConsistencyLevel
is setprotected com.datastax.driver.core.ConsistencyLevel getDriverConsistencyLevel()
ConsistencyLevel
public RetryPolicy getRetryPolicy()
RetryPolicy
.RetryPolicy
is not set.public void setRetryPolicy(RetryPolicy retryPolicy)
RetryPolicy
. Setting both (RetryPolicy
and
driver RetryPolicy
) retry policies is not supported.retryPolicy
- the retryPolicy to set.IllegalStateException
- if the driver RetryPolicy
is
setpublic void setRetryPolicy(com.datastax.driver.core.policies.RetryPolicy driverRetryPolicy)
RetryPolicy
. Setting both (RetryPolicy
and
driver RetryPolicy
) retry policies is not supported.driverRetryPolicy
- the driver RetryPolicy
to set.IllegalStateException
- if the RetryPolicy
is setprotected com.datastax.driver.core.policies.RetryPolicy getDriverRetryPolicy()
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–2018 Pivotal Software, Inc.. All rights reserved.