Permalink
Browse files

[pegasus] Remove default values for zkHosts

RB=713641
G=si-core-reviewers
R=dhoa,cxu,axu
A=dhoa,axu
1 parent c054859 commit 66bca9f65953325a4422f284b61a5c30dbbd6211 @ssheng ssheng committed Apr 28, 2016
@@ -67,7 +67,7 @@ public void testRouteLookupClientFuture() throws ExecutionException, Interrupted
{
RouteLookup routeLookup = new SimpleTestRouteLookup();
- final D2Client d2Client = new D2ClientBuilder().build();
+ final D2Client d2Client = new D2ClientBuilder().setZkHosts("localhost:2121").build();
d2Client.start(new FutureCallback<None>());
RouteLookupClient routeLookupClient = new RouteLookupClient(d2Client, routeLookup, "WestCoast");
RestRequest dummyRestRequest = new RestRequestBuilder(URI.create("d2://simple_uri")).build();
@@ -96,7 +96,7 @@ public void testRouteLookupClientCallback()
{
RouteLookup routeLookup = new SimpleTestRouteLookup();
- final D2Client d2Client = new D2ClientBuilder().build();
+ final D2Client d2Client = new D2ClientBuilder().setZkHosts("localhost:2121").build();
d2Client.start(new FutureCallback<None>());
RouteLookupClient routeLookupClient = new RouteLookupClient(d2Client, routeLookup, "WestCoast");
RestRequest dummyRestRequest = new RestRequestBuilder(URI.create("d2://simple_uri")).build();
@@ -27,7 +27,7 @@
public class D2ClientConfig
{
- String zkHosts = "localhost:2121";
+ String zkHosts = null;
long zkSessionTimeoutInMs = 3600000L;
long zkStartupTimeoutInMs = 10000L;
long lbWaitTimeout = 5000L;
@@ -263,6 +263,11 @@ public void start(final Callback<None> callback)
LOG.info("ZK connect string: {}", _connectString);
LOG.info("ZK session timeout: {}ms", _sessionTimeout);
LOG.info("ZK initial connect timeout: {}ms", _initialZKTimeout);
+ if (_connectString == null || _connectString.isEmpty())
+ {
+ callback.onError(new IllegalArgumentException("ZooKeeper connection string is null or empty"));
+ return;
+ }
if (_zkFlagFile == null)
{
LOG.info("ZK flag file not specified");

0 comments on commit 66bca9f

Please sign in to comment.