This is an automated email from the ASF dual-hosted git repository.
zhaijia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new c11f5f0 ISSUE #986: in LocalBK.main do Sys.exit in the case of an Exc
c11f5f0 is described below
commit c11f5f03139c3f42495e90cd68ce0b0c77aad616
Author: cguttapalem <[email protected]>
AuthorDate: Tue Jan 16 16:33:50 2018 +0800
ISSUE #986: in LocalBK.main do Sys.exit in the case of an Exc
Descriptions of the changes in this PR:
in LocalBookKeeper.main method if there is any exception then it should do
System.exit. This is needed, because, some non-daemon thread (probably in ZK
or some other dependent service) is preventing the JVM from exiting, though
there is exception in main thread.
Master Issue: #986
Author: cguttapalem <[email protected]>
Reviewers: Jia Zhai <None>, Sijie Guo <[email protected]>
This closes #987 from reddycharan/minorlocalbookkeeperfix, closes #986
---
.../apache/bookkeeper/util/LocalBookKeeper.java | 66 ++++++++++++----------
1 file changed, 37 insertions(+), 29 deletions(-)
diff --git
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
index d4ecccc..a735ed8 100644
---
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
+++
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
@@ -407,41 +407,49 @@ public class LocalBookKeeper {
}
public static void main(String[] args) throws Exception, SecurityException
{
- if (args.length < 1) {
- usage();
- System.exit(-1);
- }
+ try {
+ if (args.length < 1) {
+ usage();
+ System.exit(-1);
+ }
- int numBookies = Integer.parseInt(args[0]);
+ int numBookies = Integer.parseInt(args[0]);
- ServerConfiguration conf = new ServerConfiguration();
- conf.setAllowLoopback(true);
- if (args.length >= 2) {
- String confFile = args[1];
- try {
- conf.loadConf(new File(confFile).toURI().toURL());
- LOG.info("Using configuration file " + confFile);
- } catch (Exception e) {
- // load conf failed
- LOG.warn("Error loading configuration file " + confFile, e);
+ ServerConfiguration conf = new ServerConfiguration();
+ conf.setAllowLoopback(true);
+ if (args.length >= 2) {
+ String confFile = args[1];
+ try {
+ conf.loadConf(new File(confFile).toURI().toURL());
+ LOG.info("Using configuration file " + confFile);
+ } catch (Exception e) {
+ // load conf failed
+ LOG.warn("Error loading configuration file " + confFile,
e);
+ }
}
- }
- String zkDataDir = null;
- if (args.length >= 3) {
- zkDataDir = args[2];
- }
+ String zkDataDir = null;
+ if (args.length >= 3) {
+ zkDataDir = args[2];
+ }
- String localBookiesConfigDirName = defaultLocalBookiesConfigDir;
- if (args.length >= 4) {
- localBookiesConfigDirName = args[3];
- }
+ String localBookiesConfigDirName = defaultLocalBookiesConfigDir;
+ if (args.length >= 4) {
+ localBookiesConfigDirName = args[3];
+ }
- startLocalBookiesInternal(
- conf, zooKeeperDefaultHost, zooKeeperDefaultPort,
- numBookies, true, bookieDefaultInitialPort,
- false, "test",
- zkDataDir, localBookiesConfigDirName);
+ startLocalBookiesInternal(conf, zooKeeperDefaultHost,
zooKeeperDefaultPort, numBookies, true,
+ bookieDefaultInitialPort, false, "test", zkDataDir,
localBookiesConfigDirName);
+ } catch (Exception e) {
+ LOG.error("Exiting LocalBookKeeper because of exception in main
method", e);
+ e.printStackTrace();
+ /*
+ * This is needed because, some non-daemon thread (probably in ZK
or
+ * some other dependent service) is preventing the JVM from
exiting, though
+ * there is exception in main thread.
+ */
+ System.exit(-1);
+ }
}
private static void usage() {
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].