Elffuss BraidHub

kikocis/java-driver public

Merge pull request #799 from datastax/java1334

JAVA-1334: Clarify documentation of method addContactPoints
Changeset33225dc7a799121a2e9a92bde50672792dd13ab4f578807c03305003930d752e
AuthorAlexandre Dutra <adutra@users.noreply.github.com> · 2017-02-10 17:12 +01:00
CommitterGitHub <noreply@github.com> · 2017-02-10 17:12 +01:00
Parents81c62674441f, a3dbacfe2a6d

Browse the files at this changeset

2 files changed

modified changelog/README.md +1 −0
@@ -4,6 +4,7 @@
44
55 - [bug] JAVA-1371: Reintroduce connection pool timeout.
66 - [bug] JAVA-1313: Copy SerialConsistencyLevel to PreparedStatement.
7+- [documentation] JAVA-1334: Clarify documentation of method `addContactPoints`.
78
89
910 ### 3.0.6
modified driver-core/src/main/java/com/datastax/driver/core/Cluster.java +29 −19
@@ -803,7 +803,7 @@
803803 }
804804
805805 /**
806- * Adds a contact point - or many if it host resolves to multiple
806+ * Adds a contact point - or many if the given address resolves to multiple
807807 * <code>InetAddress</code>s (A records).
808808 * <p/>
809809 * Contact points are addresses of Cassandra nodes that the driver uses
@@ -814,7 +814,7 @@
814814 * the driver cannot initialize itself correctly.
815815 * <p/>
816816 * Note that by default (that is, unless you use the {@link #withLoadBalancingPolicy})
817- * method of this builder), the first succesfully contacted host will be used
817+ * method of this builder), the first successfully contacted host will be used
818818 * to define the local data-center for the client. If follows that if you are
819819 * running Cassandra in a multiple data-center setting, it is a good idea to
820820 * only provide contact points that are in the same datacenter than the client,
@@ -824,15 +824,15 @@
824824 * returned will be used. Make sure that all resulting <code>InetAddress</code>s returned
825825 * point to the same cluster and datacenter.
826826 *
827- * @param address the address of the node(s) to connect to
827+ * @param address the address of the node(s) to connect to.
828828 * @return this Builder.
829- * @throws IllegalArgumentException if no IP address for {@code address}
830- * could be found
829+ * @throws IllegalArgumentException if the given {@code address}
830+ * could not be resolved.
831831 * @throws SecurityException if a security manager is present and
832832 * permission to resolve the host name is denied.
833833 */
834834 public Builder addContactPoint(String address) {
835- // We explicitely check for nulls because InetAdress.getByName() will happily
835+ // We explicitly check for nulls because InetAdress.getByName() will happily
836836 // accept it and use localhost (while a null here almost likely mean a user error,
837837 // not "connect to localhost")
838838 if (address == null)
@@ -851,11 +851,14 @@
851851 * <p/>
852852 * See {@link Builder#addContactPoint} for more details on contact
853853 * points.
854+ * <p/>
855+ * Note that all contact points must be resolvable;
856+ * if <em>any</em> of them cannot be resolved, this method will fail.
854857 *
855- * @param addresses addresses of the nodes to add as contact point.
858+ * @param addresses addresses of the nodes to add as contact points.
856859 * @return this Builder.
857- * @throws IllegalArgumentException if no IP address for at least one
858- * of {@code addresses} could be found
860+ * @throws IllegalArgumentException if any of the given {@code addresses}
861+ * could not be resolved.
859862 * @throws SecurityException if a security manager is present and
860863 * permission to resolve the host name is denied.
861864 * @see Builder#addContactPoint
@@ -871,9 +874,16 @@
871874 * <p/>
872875 * See {@link Builder#addContactPoint} for more details on contact
873876 * points.
877+ * <p/>
878+ * Note that all contact points must be resolvable;
879+ * if <em>any</em> of them cannot be resolved, this method will fail.
874880 *
875- * @param addresses addresses of the nodes to add as contact point.
881+ * @param addresses addresses of the nodes to add as contact points.
876882 * @return this Builder.
883+ * @throws IllegalArgumentException if any of the given {@code addresses}
884+ * could not be resolved.
885+ * @throws SecurityException if a security manager is present and
886+ * permission to resolve the host name is denied.
877887 * @see Builder#addContactPoint
878888 */
879889 public Builder addContactPoints(InetAddress... addresses) {
@@ -887,7 +897,7 @@
887897 * See {@link Builder#addContactPoint} for more details on contact
888898 * points.
889899 *
890- * @param addresses addresses of the nodes to add as contact point
900+ * @param addresses addresses of the nodes to add as contact points.
891901 * @return this Builder
892902 * @see Builder#addContactPoint
893903 */
@@ -901,19 +911,19 @@
901911 * <p/>
902912 * See {@link Builder#addContactPoint} for more details on contact
903913 * points. Contrarily to other {@code addContactPoints} methods, this method
904- * allow to provide a different port for each contact points. Since Cassandra
905- * nodes must always all listen on the same port, this is rarelly what you
914+ * allows to provide a different port for each contact point. Since Cassandra
915+ * nodes must always all listen on the same port, this is rarely what you
906916 * want and most users should prefer other {@code addContactPoints} methods to
907917 * this one. However, this can be useful if the Cassandra nodes are behind
908918 * a router and are not accessed directly. Note that if you are in this
909919 * situation (Cassandra nodes are behind a router, not directly accessible),
910- * you almost surely want to provide a specific {@code AddressTranslator}
920+ * you almost surely want to provide a specific {@link AddressTranslator}
911921 * (through {@link #withAddressTranslator}) to translate actual Cassandra node
912922 * addresses to the addresses the driver should use, otherwise the driver
913923 * will not be able to auto-detect new nodes (and will generally not function
914924 * optimally).
915925 *
916- * @param addresses addresses of the nodes to add as contact point
926+ * @param addresses addresses of the nodes to add as contact points.
917927 * @return this Builder
918928 * @see Builder#addContactPoint
919929 */
@@ -927,19 +937,19 @@
927937 * <p/>
928938 * See {@link Builder#addContactPoint} for more details on contact
929939 * points. Contrarily to other {@code addContactPoints} methods, this method
930- * allow to provide a different port for each contact points. Since Cassandra
931- * nodes must always all listen on the same port, this is rarelly what you
940+ * allows to provide a different port for each contact point. Since Cassandra
941+ * nodes must always all listen on the same port, this is rarely what you
932942 * want and most users should prefer other {@code addContactPoints} methods to
933943 * this one. However, this can be useful if the Cassandra nodes are behind
934944 * a router and are not accessed directly. Note that if you are in this
935945 * situation (Cassandra nodes are behind a router, not directly accessible),
936- * you almost surely want to provide a specific {@code AddressTranslator}
946+ * you almost surely want to provide a specific {@link AddressTranslator}
937947 * (through {@link #withAddressTranslator}) to translate actual Cassandra node
938948 * addresses to the addresses the driver should use, otherwise the driver
939949 * will not be able to auto-detect new nodes (and will generally not function
940950 * optimally).
941951 *
942- * @param addresses addresses of the nodes to add as contact point
952+ * @param addresses addresses of the nodes to add as contact points.
943953 * @return this Builder
944954 * @see Builder#addContactPoint
945955 */