File tree Expand file tree Collapse file tree
driver-core/src/main/java/com/datastax/driver/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -770,6 +770,38 @@ public Builder addContactPoints(String... addresses) {
770770 return this ;
771771 }
772772
773+ /**
774+ * Adds a contact point - or many if it host resolves to multiple <code>InetAddress</code>s (A records).
775+ * <p>
776+ *
777+ * If the host name points to a dns records with multiple a-records, all InetAddresses
778+ * returned will be used. Make sure that all resulting <code>InetAddress</code>s returned
779+ * points to the same cluster and datacenter.
780+ * <p>
781+ * See {@link Builder#addContactPoint} for more details on contact
782+ * points and thrown exceptions
783+ *
784+ * @param address address of the nodes to look up InetAddresses from to add as contact points.
785+ * @return this Builder.
786+ *
787+ *
788+ * @see Builder#addContactPoint
789+ */
790+ public Builder addContactPoints (String address ) {
791+ // We explicitely check for nulls because InetAdress.getByName() will happily
792+ // accept it and use localhost (while a null here almost likely mean a user error,
793+ // not "connect to localhost")
794+ if (address == null )
795+ throw new NullPointerException ();
796+
797+ try {
798+ addContactPoints (InetAddress .getAllByName (address ));
799+ } catch (UnknownHostException e ) {
800+ throw new IllegalArgumentException (e .getMessage ());
801+ }
802+ return this ;
803+ }
804+
773805 /**
774806 * Adds contact points.
775807 * <p>
You can’t perform that action at this time.
0 commit comments