public class ProtocolOptions extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ProtocolOptions.Compression
Compression supported by the Cassandra binary protocol.
|
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_LOCAL_PORT_HIGH |
static int |
DEFAULT_LOCAL_PORT_LOW |
static int |
DEFAULT_MAX_SCHEMA_AGREEMENT_WAIT_SECONDS
The default value for
getMaxSchemaAgreementWaitSeconds() : 10. |
static int |
DEFAULT_PORT
The default port for Cassandra native binary protocol: 9042.
|
Constructor and Description |
---|
ProtocolOptions()
Creates a new
ProtocolOptions instance using the DEFAULT_PORT (and without
SSL). |
ProtocolOptions(int port)
Creates a new
ProtocolOptions instance using the provided port (without SSL nor
authentication). |
ProtocolOptions(int port,
ProtocolVersion protocolVersion,
int maxSchemaAgreementWaitSeconds,
SSLOptions sslOptions,
AuthProvider authProvider)
Creates a new
ProtocolOptions instance using the provided port and SSL context. |
ProtocolOptions(int port,
ProtocolVersion protocolVersion,
int maxSchemaAgreementWaitSeconds,
SSLOptions sslOptions,
AuthProvider authProvider,
boolean noCompact)
Creates a new
ProtocolOptions instance using the provided port and SSL context. |
ProtocolOptions(int port,
ProtocolVersion protocolVersion,
int maxSchemaAgreementWaitSeconds,
SSLOptions sslOptions,
AuthProvider authProvider,
boolean noCompact,
boolean useAdvancedShardAwarness,
int portLow,
int portHigh)
Creates a new
ProtocolOptions instance using the provided port and SSL context. |
Modifier and Type | Method and Description |
---|---|
AuthProvider |
getAuthProvider()
The
AuthProvider used by this cluster. |
ProtocolOptions.Compression |
getCompression()
Returns the compression used by the protocol.
|
int |
getHighLocalPort() |
int |
getLowLocalPort() |
int |
getMaxSchemaAgreementWaitSeconds()
Returns the maximum time to wait for schema agreement before returning from a DDL query.
|
int |
getPort()
Returns the port used to connect to the Cassandra hosts.
|
ProtocolVersion |
getProtocolVersion()
The protocol version used by the Cluster instance.
|
SSLOptions |
getSSLOptions()
The
SSLOptions used by this cluster. |
boolean |
isNoCompact() |
boolean |
isUseAdvancedShardAwareness() |
ProtocolOptions |
setCompression(ProtocolOptions.Compression compression)
Sets the compression to use.
|
public static final int DEFAULT_PORT
public static final int DEFAULT_MAX_SCHEMA_AGREEMENT_WAIT_SECONDS
getMaxSchemaAgreementWaitSeconds()
: 10.public static final int DEFAULT_LOCAL_PORT_LOW
public static final int DEFAULT_LOCAL_PORT_HIGH
public ProtocolOptions()
ProtocolOptions
instance using the DEFAULT_PORT
(and without
SSL).public ProtocolOptions(int port)
ProtocolOptions
instance using the provided port (without SSL nor
authentication).
This is a shortcut for new ProtocolOptions(port, null, AuthProvider.NONE)
.
port
- the port to use for the binary protocol.public ProtocolOptions(int port, ProtocolVersion protocolVersion, int maxSchemaAgreementWaitSeconds, SSLOptions sslOptions, AuthProvider authProvider)
ProtocolOptions
instance using the provided port and SSL context.port
- the port to use for the binary protocol.protocolVersion
- the protocol version to use. This can be null
, in which case the
version used will be the biggest version supported by the first node the driver
connects to. See Cluster.Builder.withProtocolVersion(com.datastax.driver.core.ProtocolVersion)
for more details.sslOptions
- the SSL options to use. Use null
if SSL is not to be used.authProvider
- the AuthProvider
to use for authentication against the Cassandra
nodes.public ProtocolOptions(int port, ProtocolVersion protocolVersion, int maxSchemaAgreementWaitSeconds, SSLOptions sslOptions, AuthProvider authProvider, boolean noCompact)
ProtocolOptions
instance using the provided port and SSL context.port
- the port to use for the binary protocol.protocolVersion
- the protocol version to use. This can be null
, in which case the
version used will be the biggest version supported by the first node the driver
connects to. See Cluster.Builder.withProtocolVersion(com.datastax.driver.core.ProtocolVersion)
for more details.sslOptions
- the SSL options to use. Use null
if SSL is not to be used.authProvider
- the AuthProvider
to use for authentication against the Cassandra
nodes.noCompact
- whether or not to include the NO_COMPACT startup option.public ProtocolOptions(int port, ProtocolVersion protocolVersion, int maxSchemaAgreementWaitSeconds, SSLOptions sslOptions, AuthProvider authProvider, boolean noCompact, boolean useAdvancedShardAwarness, int portLow, int portHigh)
ProtocolOptions
instance using the provided port and SSL context.port
- the port to use for the binary protocol.protocolVersion
- the protocol version to use. This can be null
, in which case the
version used will be the biggest version supported by the first node the driver
connects to. See Cluster.Builder.withProtocolVersion(com.datastax.driver.core.ProtocolVersion)
for more details.sslOptions
- the SSL options to use. Use null
if SSL is not to be used.authProvider
- the AuthProvider
to use for authentication against the Cassandra
nodes.noCompact
- whether or not to include the NO_COMPACT startup option.useAdvancedShardAwarness
- should the advanced shard awarness (choosing shard to connect
to by client-side port) be used.portLow
- lower bound (inclusive) of ports to use for advanced shard awareness.portHigh
- upper bound (inclusive) of ports to use for advanced shard awareness.public int getPort()
public ProtocolVersion getProtocolVersion()
null
if a particular version
hasn't been forced by the user (using say {Cluster.Builder#withProtocolVersion})
and this Cluster instance has not yet connected to any node (but as soon as the
Cluster instance is connected, this is guaranteed to return a non-null value). Note that
nodes that do not support this protocol version will be ignored.public ProtocolOptions.Compression getCompression()
By default, compression is not used.
public ProtocolOptions setCompression(ProtocolOptions.Compression compression)
Note that while this setting can be changed at any time, it will only apply to newly created connections.
compression
- the compression algorithm to use (or Compression.NONE
to disable
compression).ProtocolOptions
object.IllegalStateException
- if the compression requested is not available. Most compression
algorithms require that the relevant be present in the classpath. If not, the compression
will be unavailable.public int getMaxSchemaAgreementWaitSeconds()
public SSLOptions getSSLOptions()
SSLOptions
used by this cluster.SSLOptions
used by this cluster (set at the cluster creation time) or
null
if SSL is not in use.public AuthProvider getAuthProvider()
AuthProvider
used by this cluster.AuthProvided
used by this cluster (set at the cluster creation time). If no
authentication mechanism is in use (the default), AuthProvided.NONE
will be
returned.public boolean isNoCompact()
public boolean isUseAdvancedShardAwareness()
public int getLowLocalPort()
public int getHighLocalPort()
Copyright © 2012–2024. All rights reserved.