You are viewing a plain text version of this content. The canonical link for it is here.
Posted to distributedlog-commits@bookkeeper.apache.org by si...@apache.org on 2017/11/01 16:06:44 UTC
[distributedlog] 02/02: Update exception handling in constructing
bookkeeper client
This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/distributedlog.git
commit 1485241ff1bebc3bad0d100beac9a61076f0265d
Author: Jia Zhai <zh...@apache.org>
AuthorDate: Wed Nov 1 01:39:24 2017 -0700
Update exception handling in constructing bookkeeper client
---
.../apache/distributedlog/BookKeeperClient.java | 26 +++++++++++-----------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/distributedlog-core/src/main/java/org/apache/distributedlog/BookKeeperClient.java b/distributedlog-core/src/main/java/org/apache/distributedlog/BookKeeperClient.java
index d1c1d6f..33baa9d 100644
--- a/distributedlog-core/src/main/java/org/apache/distributedlog/BookKeeperClient.java
+++ b/distributedlog-core/src/main/java/org/apache/distributedlog/BookKeeperClient.java
@@ -41,10 +41,8 @@ import org.apache.distributedlog.ZooKeeperClient.DigestCredentials;
import org.apache.distributedlog.common.concurrent.FutureUtils;
import org.apache.distributedlog.exceptions.AlreadyClosedException;
import org.apache.distributedlog.exceptions.DLInterruptedException;
-import org.apache.distributedlog.exceptions.ZKException;
import org.apache.distributedlog.net.NetUtils;
import org.apache.distributedlog.util.ConfUtils;
-import org.apache.zookeeper.KeeperException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -85,7 +83,7 @@ public class BookKeeperClient {
String ledgersPath,
EventLoopGroup eventLoopGroup,
StatsLogger statsLogger, HashedWheelTimer requestTimer)
- throws IOException, InterruptedException, KeeperException {
+ throws IOException, InterruptedException {
ClientConfiguration bkConfig = new ClientConfiguration();
bkConfig.setAddEntryTimeout(conf.getBKClientWriteTimeout());
bkConfig.setReadTimeout(conf.getBKClientReadTimeout());
@@ -109,14 +107,18 @@ public class BookKeeperClient {
final DNSToSwitchMapping dnsResolver =
NetUtils.getDNSResolver(dnsResolverCls, conf.getBkDNSResolverOverrides());
- this.bkc = BookKeeper.forConfig(bkConfig)
- .setZookeeper(zkc.get())
- .setEventLoopGroup(eventLoopGroup)
- .setStatsLogger(statsLogger)
- .dnsResolver(dnsResolver)
- .requestTimer(requestTimer)
- .featureProvider(featureProvider.orNull())
- .build();
+ try {
+ this.bkc = BookKeeper.forConfig(bkConfig)
+ .setZookeeper(zkc.get())
+ .setEventLoopGroup(eventLoopGroup)
+ .setStatsLogger(statsLogger)
+ .dnsResolver(dnsResolver)
+ .requestTimer(requestTimer)
+ .featureProvider(featureProvider.orNull())
+ .build();
+ } catch (BKException bke) {
+ throw new IOException(bke);
+ }
}
BookKeeperClient(DistributedLogConfiguration conf,
@@ -167,8 +169,6 @@ public class BookKeeperClient {
commonInitialization(conf, ledgersPath, eventLoopGroup, statsLogger, requestTimer);
} catch (InterruptedException e) {
throw new DLInterruptedException("Interrupted on creating bookkeeper client " + name + " : ", e);
- } catch (KeeperException e) {
- throw new ZKException("Error on creating bookkeeper client " + name + " : ", e);
}
if (ownZK) {
--
To stop receiving notification emails like this one, please contact
"distributedlog-commits@bookkeeper.apache.org" <di...@bookkeeper.apache.org>.