activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject [39/48] activemq-artemis git commit: Fix AddressCommandTest
Date Wed, 23 Nov 2016 17:43:40 GMT
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 <jbertram@apache.com>
Authored: Mon Nov 21 17:06:02 2016 -0600
Committer: jbertram <jbertram@apache.com>
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);
    }
 


Mime
View raw message