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_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
(and without SSL). |
ProtocolOptions(int port,
SSLOptions sslOptions)
Creates a new
ProtocolOptions instance using the provided port
and SSL context. |
Modifier and Type | Method and Description |
---|---|
ProtocolOptions.Compression |
getCompression()
Returns the compression used by the protocol.
|
int |
getPort()
Returns the port used to connect to the Cassandra hosts.
|
ProtocolOptions |
setCompression(ProtocolOptions.Compression compression)
Sets the compression to use.
|
public static final int DEFAULT_PORT
public ProtocolOptions()
ProtocolOptions
instance using the DEFAULT_PORT
(and without SSL).public ProtocolOptions(int port)
ProtocolOptions
instance using the provided port
(and without SSL).
This is a shortcut for new ProtocolOptions(port, null)
.
port
- the port to use for the binary protocol.public ProtocolOptions(int port, SSLOptions sslOptions)
ProtocolOptions
instance using the provided port
and SSL context.port
- the port to use for the binary protocol.sslOptions
- the SSL options to use. Use null
if SSL is not
to be used.public int getPort()
public ProtocolOptions.Compression getCompression()
The default compression is Compression.SNAPPY
.
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.Copyright © 2014. All Rights Reserved.