Skip to content
Permalink
Browse files
CURATOR-585: fix DiscoveryExample did not check for exceptions
Author: wangjie <wangchenmo1025@gmail.com>

Reviewers: Enrico Olivelli <eolivelli@apache.org>

Closes #375 from iwangjie/CURATOR-585
  • Loading branch information
iwangjie authored and Enrico Olivelli committed Jan 18, 2021
1 parent cac0918 commit 39ed945af4147289d98cd2089e39954d09448577
Showing 1 changed file with 7 additions and 0 deletions.
@@ -33,6 +33,8 @@
import org.apache.curator.x.discovery.ServiceProvider;
import org.apache.curator.x.discovery.details.JsonInstanceSerializer;
import org.apache.curator.x.discovery.strategies.RandomStrategy;
import org.apache.zookeeper.KeeperException;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
@@ -191,6 +193,11 @@ private static void listInstances(ServiceDiscovery<InstanceDetails> serviceDisco
outputInstance(instance);
}
}

}
catch ( KeeperException.NoNodeException e )
{
System.err.println("There are no registered instances.");
}
finally
{

0 comments on commit 39ed945

Please sign in to comment.