|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.datastax.driver.core.Cluster.Builder
public static class Cluster.Builder
Helper class to build Cluster
instances.
Constructor Summary | |
---|---|
Cluster.Builder()
|
Method Summary | |
---|---|
Cluster.Builder |
addContactPoint(String address)
Adds a contact point. |
Cluster.Builder |
addContactPoints(InetAddress... addresses)
Add contact points. |
Cluster.Builder |
addContactPoints(String... addresses)
Add contact points. |
Cluster |
build()
Build the cluster with the configured set of initial contact points and policies. |
Configuration |
getConfiguration()
The configuration that will be used for the new cluster. |
List<InetAddress> |
getContactPoints()
Returns the initial Cassandra hosts to connect to. |
PoolingOptions |
poolingOptions()
The pooling options used by this builder. |
SocketOptions |
socketOptions()
The socket options used by this builder. |
Cluster.Builder |
withAuthInfoProvider(AuthInfoProvider authInfoProvider)
Use the provided AuthInfoProvider to connect to Cassandra hosts. |
Cluster.Builder |
withCompression(ProtocolOptions.Compression compression)
Sets the compression to use for the transport. |
Cluster.Builder |
withLoadBalancingPolicy(LoadBalancingPolicy policy)
Configure the load balancing policy to use for the new cluster. |
Cluster.Builder |
withoutMetrics()
Disable metrics collection for the created cluster (metrics are enabled by default otherwise). |
Cluster.Builder |
withPort(int port)
The port to use to connect to the Cassandra host. |
Cluster.Builder |
withReconnectionPolicy(ReconnectionPolicy policy)
Configure the reconnection policy to use for the new cluster. |
Cluster.Builder |
withRetryPolicy(RetryPolicy policy)
Configure the retry policy to use for the new cluster. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Cluster.Builder()
Method Detail |
---|
public List<InetAddress> getContactPoints()
Cluster.Initializer
getContactPoints
in interface Cluster.Initializer
addContactPoint(java.lang.String)
for more details on contact points.public Cluster.Builder withPort(int port)
port
- the port to set.
public Cluster.Builder addContactPoint(String address)
address
- the address of the node to connect to
IllegalArgumentException
- if no IP address for address
could be found
SecurityException
- if a security manager is present and
permission to resolve the host name is denied.public Cluster.Builder addContactPoints(String... addresses)
addContactPoint(java.lang.String)
for more details on contact
points.
addresses
- addresses of the nodes to add as contact point
IllegalArgumentException
- if no IP address for at least one
of addresses
could be found
SecurityException
- if a security manager is present and
permission to resolve the host name is denied.addContactPoint(java.lang.String)
public Cluster.Builder addContactPoints(InetAddress... addresses)
addContactPoint(java.lang.String)
for more details on contact
points.
addresses
- addresses of the nodes to add as contact point
addContactPoint(java.lang.String)
public Cluster.Builder withLoadBalancingPolicy(LoadBalancingPolicy policy)
If no load balancing policy is set through this method,
Policies.DEFAULT_LOAD_BALANCING_POLICY
will be used instead.
policy
- the load balancing policy to use
public Cluster.Builder withReconnectionPolicy(ReconnectionPolicy policy)
If no reconnection policy is set through this method,
Policies.DEFAULT_RECONNECTION_POLICY
will be used instead.
policy
- the reconnection policy to use
public Cluster.Builder withRetryPolicy(RetryPolicy policy)
If no retry policy is set through this method,
Policies.DEFAULT_RETRY_POLICY
will be used instead.
policy
- the retry policy to use
public Cluster.Builder withAuthInfoProvider(AuthInfoProvider authInfoProvider)
AuthInfoProvider
to connect to Cassandra hosts.
This is optional if the Cassandra cluster has been configured to not require authentication (the default).
authInfoProvider
- the authentication info provider to use
public Cluster.Builder withCompression(ProtocolOptions.Compression compression)
compression
- the compression to set
ProtocolOptions.Compression
public Cluster.Builder withoutMetrics()
public PoolingOptions poolingOptions()
public SocketOptions socketOptions()
public Configuration getConfiguration()
You should not modify this object directly as change made
to the returned object may not be used by the cluster build.
Instead, you should use the other methods of this Builder
.
getConfiguration
in interface Cluster.Initializer
public Cluster build()
Cluster.buildFrom(this)
.
NoHostAvailableException
- if none of the contact points
provided can be reached.
AuthenticationException
- if while contacting the initial
contact points an authencation error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |