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 91ED8200BC8 for ; Wed, 23 Nov 2016 18:43:07 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 8F3DD160AEC; Wed, 23 Nov 2016 17:43:07 +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 A08C9160B28 for ; Wed, 23 Nov 2016 18:43:06 +0100 (CET) Received: (qmail 53073 invoked by uid 500); 23 Nov 2016 17:43:05 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 50207 invoked by uid 99); 23 Nov 2016 17:43:03 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Nov 2016 17:43:03 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 56C1AF1774; Wed, 23 Nov 2016 17:43:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jbertram@apache.org To: commits@activemq.apache.org Date: Wed, 23 Nov 2016 17:43:40 -0000 Message-Id: In-Reply-To: <8ee90db24df54d2ab8ee79e24b3991fc@git.apache.org> References: <8ee90db24df54d2ab8ee79e24b3991fc@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [39/48] activemq-artemis git commit: Fix AddressCommandTest archived-at: Wed, 23 Nov 2016 17:43:07 -0000 Fix AddressCommandTest Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/22444639 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/22444639 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/22444639 Branch: refs/heads/ARTEMIS-780 Commit: 2244463982429bd53ee2a0e11eb53d30da480021 Parents: 5a4a4c9 Author: jbertram Authored: Mon Nov 21 17:06:02 2016 -0600 Committer: jbertram Committed: Wed Nov 23 09:04:36 2016 -0600 ---------------------------------------------------------------------- .../impl/ActiveMQServerControlImpl.java | 18 ++++++++++++------ .../core/server/impl/ActiveMQServerImpl.java | 10 +++------- 2 files changed, 15 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/22444639/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java index e5ad233..f8880fc 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java @@ -787,12 +787,18 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active @Override public String getAddressInfo(String address) throws ActiveMQAddressDoesNotExistException { - AddressInfo addressInfo = server.getAddressInfo(SimpleString.toSimpleString(address)); - if (addressInfo == null) { -// throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(SimpleString.toSimpleString(address)); - return null; - } else { - return addressInfo.toString(); + checkStarted(); + + clearIO(); + try { + AddressInfo addressInfo = server.getAddressInfo(SimpleString.toSimpleString(address)); + if (addressInfo == null) { + throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(SimpleString.toSimpleString(address)); + } else { + return addressInfo.toString(); + } + } finally { + blockOnIO(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/22444639/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java index 16dccbb..990e2e0 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java @@ -2271,11 +2271,6 @@ public class ActiveMQServerImpl implements ActiveMQServer { if (putAddressInfoIfAbsent(addressInfo) != null) { throw ActiveMQMessageBundle.BUNDLE.addressAlreadyExists(addressInfo.getName()); } - - // TODO: is this the right way to do this? - long txID = storageManager.generateID(); - storageManager.addAddressBinding(txID, addressInfo); - storageManager.commitBindings(txID); } @Override @@ -2292,13 +2287,14 @@ public class ActiveMQServerImpl implements ActiveMQServer { @Override public void removeAddressInfo(SimpleString address) throws Exception { + AddressInfo addressInfo = getAddressInfo(address); if (postOffice.removeAddressInfo(address) == null) { throw ActiveMQMessageBundle.BUNDLE.addressDoesNotExist(address); } - // TODO: is this the right way to do this? + // TODO: is this the right way to do this? Should it use a transaction? long txID = storageManager.generateID(); - storageManager.deleteAddressBinding(txID, getAddressInfo(address).getId()); + storageManager.deleteAddressBinding(txID, addressInfo.getId()); storageManager.commitBindings(txID); }