Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include support for comma seperated strings for basic.contact-points #1897

Open
wants to merge 2 commits into
base: 4.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
Expand Down Expand Up @@ -858,8 +859,16 @@ protected final CompletionStage<CqlSession> buildDefaultSessionAsync() {
cloudConfigInputStream = () -> getURL(configUrlString).openStream();
}
}
List<String> configContactPoints =
defaultConfig.getStringList(DefaultDriverOption.CONTACT_POINTS, Collections.emptyList());
List<String> configContactPoints;
if (defaultConfig.getString(DefaultDriverOption.CONTACT_POINTS).contains(",")) {
configContactPoints =
Arrays.asList(
defaultConfig.getString(DefaultDriverOption.CONTACT_POINTS, "").split(","));
} else {
configContactPoints =
defaultConfig.getStringList(
DefaultDriverOption.CONTACT_POINTS, Collections.emptyList());
}
if (cloudConfigInputStream != null) {
if (!programmaticContactPoints.isEmpty() || !configContactPoints.isEmpty()) {
LOG.info(
Expand Down
7 changes: 4 additions & 3 deletions core/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ datastax-java-driver {
# automatically), but it is usually a good idea to provide more than one contact point, because if
# that single contact point is unavailable, the driver cannot initialize itself correctly.
#
# This must be a list of strings with each contact point specified as "host:port". If the host is
# a DNS name that resolves to multiple A-records, all the corresponding addresses will be used. Do
# not use "localhost" as the host name (since it resolves to both IPv4 and IPv6 addresses on some
# This must be a list of strings or a comma seperated string with each contact point specified as "host:port".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# This must be a list of strings or a comma seperated string with each contact point specified as "host:port".
# This must be a list of strings or a comma separated string with each contact point specified as "host:port".

# If the host is a DNS name that resolves to multiple A-records, all the corresponding addresses will be used.
# Do not use "localhost" as the host name (since it resolves to both IPv4 and IPv6 addresses on some
# platforms).
#
# Note that Cassandra 3 and below requires all nodes in a cluster to share the same port (see
Expand All @@ -53,6 +53,7 @@ datastax-java-driver {
# Modifiable at runtime: no
# Overridable in a profile: no
// basic.contact-points = [ "127.0.0.1:9042", "127.0.0.2:9042" ]
// basic.contact-points = "127.0.0.1:9042,127.0.0.2:9042"

# A name that uniquely identifies the driver instance created from this configuration. This is
# used as a prefix for log messages and metrics.
Expand Down