Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EA8DF20049C for ; Fri, 11 Aug 2017 12:23:19 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E914E16D125; Fri, 11 Aug 2017 10:23:19 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1614516D121 for ; Fri, 11 Aug 2017 12:23:18 +0200 (CEST) Received: (qmail 38761 invoked by uid 500); 11 Aug 2017 10:23:18 -0000 Mailing-List: contact commits-help@bookkeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: bookkeeper-dev@bookkeeper.apache.org Delivered-To: mailing list commits@bookkeeper.apache.org Received: (qmail 38752 invoked by uid 99); 11 Aug 2017 10:23:18 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Aug 2017 10:23:18 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 67C5781273; Fri, 11 Aug 2017 10:23:15 +0000 (UTC) Date: Fri, 11 Aug 2017 10:23:15 +0000 To: "commits@bookkeeper.apache.org" Subject: [bookkeeper] branch master updated: ISSUE #414: use a clone of baseconf in new ServerConfiguration(baseConf) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <150244699562.20927.12407798316106064957@gitbox.apache.org> From: sijie@apache.org Reply-To: "commits@bookkeeper.apache.org" X-Git-Host: gitbox.apache.org X-Git-Repo: bookkeeper X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 88a61eefcc23a72e9ec18d64168dddd0e2e01269 X-Git-Newrev: b4a1c76054c54d05d38a89399efa716201a2206b X-Git-Rev: b4a1c76054c54d05d38a89399efa716201a2206b X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated archived-at: Fri, 11 Aug 2017 10:23:20 -0000 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/bookkeeper.git The following commit(s) were added to refs/heads/master by this push: new b4a1c76 ISSUE #414: use a clone of baseconf in new ServerConfiguration(baseConf) b4a1c76 is described below commit b4a1c76054c54d05d38a89399efa716201a2206b Author: zhaijack AuthorDate: Fri Aug 11 03:23:08 2017 -0700 ISSUE #414: use a clone of baseconf in new ServerConfiguration(baseConf) Descriptions of the changes in this PR: This PR fix Issue #414 , and in the comments of that issue contains the anysis of the bug. Main changes: - Privde a clone of baseConf while do loadconf(baseConf), so make baseConf and newConf work independently. - Remove 'loadConf(Configuration otherConf) ', since Configuration is an interface in common-configs and not have a clone method. --- Be sure to do all of the following to help us incorporate your contribution quickly and easily: - [X] Make sure the PR title is formatted like: `: Description of pull request` `e.g. Issue 123: Description ...` `e.g. BOOKKEEPER-1234: Description ...` - [ ] Make sure tests pass via `mvn clean apache-rat:check install findbugs:check`. - [X] Replace `` in the title with the actual Issue/JIRA number. --- Author: zhaijack Reviewers: Sijie Guo This closes #424 from zhaijack/issue_414, closes #414 --- .../java/org/apache/bookkeeper/bookie/BookieShell.java | 3 +-- .../apache/bookkeeper/conf/AbstractConfiguration.java | 18 ++++-------------- .../src/main/java/org/apache/bookkeeper/util/Tool.java | 4 ++-- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java index c5a65c0..36cd832 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BookieShell.java @@ -84,7 +84,6 @@ import org.apache.commons.cli.MissingArgumentException; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; import org.apache.commons.configuration.CompositeConfiguration; -import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; @@ -2028,7 +2027,7 @@ public class BookieShell implements Tool { } @Override - public void setConf(Configuration conf) throws Exception { + public void setConf(CompositeConfiguration conf) throws Exception { bkConf.loadConf(conf); journalDirectories = Bookie.getCurrentDirectories(bkConf.getJournalDirs()); ledgerDirectories = Bookie.getCurrentDirectories(bkConf.getLedgerDirs()); diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/AbstractConfiguration.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/AbstractConfiguration.java index 5a081ce..7b89bb0 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/AbstractConfiguration.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/AbstractConfiguration.java @@ -117,8 +117,8 @@ public abstract class AbstractConfiguration extends CompositeConfiguration { * Configuration URL */ public void loadConf(URL confURL) throws ConfigurationException { - Configuration loadedConf = new PropertiesConfiguration(confURL); - addConfiguration(loadedConf); + PropertiesConfiguration loadedConf = new PropertiesConfiguration(confURL); + addConfiguration((Configuration)loadedConf.clone()); } /** @@ -127,18 +127,8 @@ public abstract class AbstractConfiguration extends CompositeConfiguration { * @param baseConf * Other Configuration */ - public void loadConf(AbstractConfiguration baseConf) { - addConfiguration(baseConf); - } - - /** - * Load configuration from other configuration object - * - * @param otherConf - * Other configuration object - */ - public void loadConf(Configuration otherConf) { - addConfiguration(otherConf); + public void loadConf(CompositeConfiguration baseConf) { + addConfiguration((CompositeConfiguration)baseConf.clone()); } /** diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/Tool.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/Tool.java index 22c56e9..0ffa00e 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/Tool.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/Tool.java @@ -18,7 +18,7 @@ package org.apache.bookkeeper.util; -import org.apache.commons.configuration.Configuration; +import org.apache.commons.configuration.CompositeConfiguration; /** * A tool interface that supports handling of generic command-line options. @@ -39,5 +39,5 @@ public interface Tool { * @param conf configuration object * @throws Exception */ - public void setConf(Configuration conf) throws Exception; + public void setConf(CompositeConfiguration conf) throws Exception; } -- To stop receiving notification emails like this one, please contact ['"commits@bookkeeper.apache.org" '].