Interface Cluster.Initializer
-
- All Known Implementing Classes:
Cluster.Builder
- Enclosing class:
- Cluster
public static interface Cluster.InitializerInitializer forClusterinstances.If you want to create a new
Clusterinstance programmatically, then it is advised to useCluster.Builderwhich can be obtained from theCluster.builder()method.But it is also possible to implement a custom
Initializerthat retrieves initialization from a web-service or from a configuration file.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetClusterName()An optional name for the created cluster.ConfigurationgetConfiguration()The configuration to use for the new cluster.List<EndPoint>getContactPoints()Returns the initial Cassandra hosts to connect to.Collection<Host.StateListener>getInitialListeners()Optional listeners to register against the newly created cluster.
-
-
-
Method Detail
-
getClusterName
String getClusterName()
An optional name for the created cluster.Such name is optional (a default name will be created otherwise) and is currently only use for JMX reporting of metrics. See
Cluster.getClusterName()for more information.- Returns:
- the name for the created cluster or
nullto use an automatically generated name.
-
getContactPoints
List<EndPoint> getContactPoints()
Returns the initial Cassandra hosts to connect to.- Returns:
- the initial Cassandra contact points. See
Cluster.Builder.addContactPoint(java.lang.String)for more details on contact points.
-
getConfiguration
Configuration getConfiguration()
The configuration to use for the new cluster.Note that some configuration can be modified after the cluster initialization but some others cannot. In particular, the ones that cannot be changed afterwards includes:
- the port use to connect to Cassandra nodes (see
ProtocolOptions). - the policies used (see
Policies). - the authentication info provided (see
Configuration). - whether metrics are enabled (see
Configuration).
- Returns:
- the configuration to use for the new cluster.
- the port use to connect to Cassandra nodes (see
-
getInitialListeners
Collection<Host.StateListener> getInitialListeners()
Optional listeners to register against the newly created cluster.Note that contrary to listeners registered post Cluster creation, the listeners returned by this method will see
Host.StateListener.onAdd(com.datastax.driver.core.Host)events for the initial contact points.- Returns:
- a possibly empty collection of
Host.StateListenerto register against the newly created cluster.
-
-