com.datastax.driver.core
Class ProtocolOptions

java.lang.Object
  extended by com.datastax.driver.core.ProtocolOptions

public class ProtocolOptions
extends Object

Options of the Cassandra native binary protocol.


Nested Class Summary
static class ProtocolOptions.Compression
          Compression supported by the Cassandra binary protocol.
 
Field Summary
static int DEFAULT_PORT
          The default port for Cassandra native binary protocol: 9042.
 
Constructor Summary
ProtocolOptions()
          Creates a new ProtocolOptions instance using the DEFAULT_PORT.
ProtocolOptions(int port)
          Creates a new ProtocolOptions instance using the provided port.
 
Method Summary
 ProtocolOptions.Compression getCompression()
          Returns the compression used by the protocol.
 int getPort()
          The port used to connect to the Cassandra hosts.
 ProtocolOptions setCompression(ProtocolOptions.Compression compression)
          Sets the compression to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
The default port for Cassandra native binary protocol: 9042.

See Also:
Constant Field Values
Constructor Detail

ProtocolOptions

public ProtocolOptions()
Creates a new ProtocolOptions instance using the DEFAULT_PORT.


ProtocolOptions

public ProtocolOptions(int port)
Creates a new ProtocolOptions instance using the provided port.

Parameters:
port - the port to use for the binary protocol.
Method Detail

getPort

public int getPort()
The port used to connect to the Cassandra hosts.

Returns:
the port used to connect to the Cassandra hosts.

getCompression

public ProtocolOptions.Compression getCompression()
Returns the compression used by the protocol.

The default compression is Compression.SNAPPY.

Returns:
the compression used.

setCompression

public ProtocolOptions setCompression(ProtocolOptions.Compression compression)
Sets the compression to use.

Note that while this setting can be changed at any time, it will only apply to newly created connections.

Parameters:
compression - the compression algorithm to use (or Compression.NONE to disable compression).
Returns:
this ProtocolOptions object.
Throws:
IllegalStateException - if the compression requested is not available. Most compression algorithms require that the relevant be present int the classpath. If not, the compression will not be available.


Copyright © 2013. All Rights Reserved.