Class Configuration
- java.lang.Object
-
- com.datastax.driver.core.Configuration
-
public class Configuration extends Object
The configuration of the cluster. It configures the following:- Cassandra protocol level configuration (compression).
- Connection pooling configurations.
- low-level TCP configuration options (tcpNoDelay, keepAlive, ...).
- Metrics related options.
- Query related options (default consistency level, fetchSize, ...).
- Netty layer customization options.
This is also where you get the configured policies, though those cannot be changed (they are set during the built of the Cluster object).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classConfiguration.BuilderA builder to create a newConfigurationobject.
-
Constructor Summary
Constructors Modifier Constructor Description protectedConfiguration(Configuration toCopy)Copy constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Configuration.Builderbuilder()Returns a builder to create a newConfigurationobject.ApplicationInfogetApplicationInfo()CodecRegistrygetCodecRegistry()Returns theCodecRegistryinstance for this configuration.StringgetDefaultKeyspace()MetricsOptionsgetMetricsOptions()Returns the metrics configuration, if metrics are enabled.NettyOptionsgetNettyOptions()Returns theNettyOptionsinstance for this configuration.PoliciesgetPolicies()Returns the policies set for the cluster.PoolingOptionsgetPoolingOptions()Returns the connection pooling configuration.ProtocolOptionsgetProtocolOptions()Returns the Cassandra binary protocol level configuration (compression).QueryOptionsgetQueryOptions()Returns the queries configuration.SocketOptionsgetSocketOptions()Returns the low-level TCP configuration options used (tcpNoDelay, keepAlive, ...).ThreadingOptionsgetThreadingOptions()booleanisDriverConfigReportingEnabled()Whether driver configuration reporting is enabled, i.e. whether the control connection sends aDRIVER_CONFIGJSON blob describing the effective driver configuration in its startup options.
-
-
-
Constructor Detail
-
Configuration
protected Configuration(Configuration toCopy)
Copy constructor.- Parameters:
toCopy- the object to copy from.
-
-
Method Detail
-
builder
public static Configuration.Builder builder()
Returns a builder to create a newConfigurationobject.You only need this if you are building the configuration yourself. If you use
Cluster.builder(), it will be done under the hood for you.- Returns:
- the builder.
-
getPolicies
public Policies getPolicies()
Returns the policies set for the cluster.- Returns:
- the policies set for the cluster.
-
getSocketOptions
public SocketOptions getSocketOptions()
Returns the low-level TCP configuration options used (tcpNoDelay, keepAlive, ...).- Returns:
- the socket options.
-
getProtocolOptions
public ProtocolOptions getProtocolOptions()
Returns the Cassandra binary protocol level configuration (compression).- Returns:
- the protocol options.
-
getPoolingOptions
public PoolingOptions getPoolingOptions()
Returns the connection pooling configuration.- Returns:
- the pooling options.
-
getMetricsOptions
public MetricsOptions getMetricsOptions()
Returns the metrics configuration, if metrics are enabled.Metrics collection is enabled by default but can be disabled at cluster construction time through
Cluster.Builder.withoutMetrics().- Returns:
- the metrics options or
nullif metrics are not enabled.
-
getQueryOptions
public QueryOptions getQueryOptions()
Returns the queries configuration.- Returns:
- the queries options.
-
getThreadingOptions
public ThreadingOptions getThreadingOptions()
- Returns:
- the threading options for this configuration.
-
getNettyOptions
public NettyOptions getNettyOptions()
Returns theNettyOptionsinstance for this configuration.- Returns:
- the
NettyOptionsinstance for this configuration.
-
getDefaultKeyspace
public String getDefaultKeyspace()
-
getApplicationInfo
public ApplicationInfo getApplicationInfo()
-
isDriverConfigReportingEnabled
@Beta public boolean isDriverConfigReportingEnabled()
Whether driver configuration reporting is enabled, i.e. whether the control connection sends aDRIVER_CONFIGJSON blob describing the effective driver configuration in its startup options. Enabled by default.This does not govern the
SESSION_IDstartup option, which every connection always sends regardless of this setting.- Returns:
trueif driver configuration reporting is enabled.
-
getCodecRegistry
public CodecRegistry getCodecRegistry()
Returns theCodecRegistryinstance for this configuration.Note that this method could return
CodecRegistry.DEFAULT_INSTANCEif no specific codec registry has been set on theCluster. In this case, care should be taken when registering new codecs as they would be immediately available to otherClusterinstances sharing the same default instance.- Returns:
- the
CodecRegistryinstance for this configuration.
-
-