Elffuss BraidHub

kikocis/java-driver public

Improve javadocs of Cluster.register() methods.
Changeset92def205f1cf72c4d489442a195875dd7f229f4d1ec45ac5fa1a6a1bdcbf86dd
AuthorAlexandre Dutra <alexandre.dutra@datastax.com> · 2015-11-13 11:16 +01:00
CommitterAlexandre Dutra <alexandre.dutra@datastax.com> · 2015-11-13 11:16 +01:00
Parents81ec312eada8

Browse the files at this changeset

1 file changed

modified driver-core/src/main/java/com/datastax/driver/core/Cluster.java +17 −11
@@ -435,10 +435,14 @@
435435 * <p>
436436 * Registering the same listener multiple times is a no-op.
437437 * <p>
438- * Note that while {@link LoadBalancingPolicy} implements
439- * {@code Host.StateListener}, the configured load balancing does not
440- * need to (and should not) be registered through this method to
441- * received host related events.
438+ * This method should be used to register additional listeners
439+ * on an already-initialized cluster.
440+ * To add listeners to a cluster object prior to its initialization,
441+ * use {@link Builder#withInitialListeners(Collection)}.
442+ * Calling this method on a non-initialized cluster
443+ * will result in the listener being
444+ * {@link com.datastax.driver.core.Host.StateListener#onRegister(Cluster) notified}
445+ * twice of cluster registration: once inside this method, and once at cluster initialization.
442446 *
443447 * @param listener the new {@link Host.StateListener} to register.
444448 * @return this {@code Cluster} object;
@@ -453,7 +457,7 @@
453457 /**
454458 * Unregisters the provided listener from being notified on hosts events.
455459 * <p>
456- * This method is a no-op if {@code listener} hadn't previously be
460+ * This method is a no-op if {@code listener} hasn't previously been
457461 * registered against this Cluster.
458462 *
459463 * @param listener the {@link Host.StateListener} to unregister.
@@ -472,13 +476,15 @@
472476 * <p>
473477 * Registering the same listener multiple times is a no-op.
474478 * <p>
475- * Be wary that the registered tracker {@code update} method will be call
479+ * Beware that the registered tracker's
480+ * {@link LatencyTracker#update(Host, Statement, Exception, long) update}
481+ * method will be called
476482 * very frequently (at the end of every query to a Cassandra host) and
477483 * should thus not be costly.
478484 * <p>
479- * The main use case for a {@code LatencyTracker} is so
480- * {@link LoadBalancingPolicy} can implement latency awareness
481- * Typically, {@link LatencyAwarePolicy} registers it's own internal
485+ * The main use case for a {@link LatencyTracker} is to allow
486+ * load balancing policies to implement latency awareness.
487+ * For example, {@link LatencyAwarePolicy} registers it's own internal
482488 * {@code LatencyTracker} (automatically, you don't have to call this
483489 * method directly).
484490 *
@@ -496,7 +502,7 @@
496502 * Unregisters the provided latency tracking from being updated
497503 * with host read latencies.
498504 * <p>
499- * This method is a no-op if {@code tracker} hadn't previously be
505+ * This method is a no-op if {@code tracker} hasn't previously been
500506 * registered against this Cluster.
501507 *
502508 * @param tracker the {@link LatencyTracker} to unregister.
@@ -528,7 +534,7 @@
528534 * Unregisters the provided schema change listener from being updated
529535 * with schema change events.
530536 * <p>
531- * This method is a no-op if {@code listener} hadn't previously be
537+ * This method is a no-op if {@code listener} hasn't previously been
532538 * registered against this Cluster.
533539 *
534540 * @param listener the {@link SchemaChangeListener} to unregister.