Elffuss BraidHub

kikocis/java-driver public

Expose the cluster Partitioner in the metadata

JAVA-179 #fixes
Changesetfae8df33a8ab3a06b119f974bb4d9280df289ae73449446c9c37043890710365
AuthorSylvain Lebresne <sylvain@datastax.com> · 2014-03-17 15:34 +01:00
CommitterSylvain Lebresne <sylvain@datastax.com> · 2014-03-17 15:34 +01:00
Parents148d1c788234

Browse the files at this changeset

3 files changed

modified driver-core/CHANGELOG.rst +2 −0
@@ -5,6 +5,8 @@
55 ------
66
77 - [new] Add method to check if a Cluster/Session instance has been closed already (JAVA-114)
8+- [new] Expose the name of the partitioner in use in the cluster metadata (JAVA-179)
9+
810
911 1.0.6:
1012 ------
modified driver-core/src/main/java/com/datastax/driver/core/ControlConnection.java +2 −0
@@ -325,6 +325,8 @@
325325 cluster.metadata.clusterName = clusterName;
326326
327327 partitioner = localRow.getString("partitioner");
328+ if (partitioner != null)
329+ cluster.metadata.partitioner = partitioner;
328330
329331 Host host = cluster.metadata.getHost(connection.address);
330332 // In theory host can't be null. However there is no point in risking a NPE in case we
modified driver-core/src/main/java/com/datastax/driver/core/Metadata.java +11 −1
@@ -33,6 +33,7 @@
3333
3434 private final Cluster.Manager cluster;
3535 volatile String clusterName;
36+ volatile String partitioner;
3637 private final ConcurrentMap<InetAddress, Host> hosts = new ConcurrentHashMap<InetAddress, Host>();
3738 private final ConcurrentMap<String, KeyspaceMetadata> keyspaces = new ConcurrentHashMap<String, KeyspaceMetadata>();
3839
@@ -181,7 +182,7 @@
181182 }
182183
183184 /**
184- * Returns the Cassandra name for the cluster connect to.
185+ * The Cassandra name for the cluster connect to.
185186 *
186187 * @return the Cassandra name for the cluster connect to.
187188 */
@@ -189,6 +190,15 @@
189190 return clusterName;
190191 }
191192
193+ /**
194+ * The partitioner in use as reported by the Cassandra nodes.
195+ *
196+ * @return the partitioner in use as reported by the Cassandra nodes.
197+ */
198+ public String getPartitioner() {
199+ return partitioner;
200+ }
201+
192202 /**
193203 * Returns the known hosts of this cluster.
194204 *