Class 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).

    • 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 new Configuration object.

        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 null if 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.
      • getDefaultKeyspace

        public String getDefaultKeyspace()
      • isDriverConfigReportingEnabled

        @Beta
        public boolean isDriverConfigReportingEnabled()
        Whether driver configuration reporting is enabled, i.e. whether the control connection sends a DRIVER_CONFIG JSON blob describing the effective driver configuration in its startup options. Enabled by default.

        This does not govern the SESSION_ID startup option, which every connection always sends regardless of this setting.

        Returns:
        true if driver configuration reporting is enabled.
      • getCodecRegistry

        public CodecRegistry getCodecRegistry()
        Returns the CodecRegistry instance for this configuration.

        Note that this method could return CodecRegistry.DEFAULT_INSTANCE if no specific codec registry has been set on the Cluster. In this case, care should be taken when registering new codecs as they would be immediately available to other Cluster instances sharing the same default instance.

        Returns:
        the CodecRegistry instance for this configuration.