You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2019/02/26 01:11:12 UTC

[activemq-artemis] branch master updated (0cf29fe -> 299e444)

This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git.


    from 0cf29fe  This closes #2563
     new a1d10c0  ARTEMIS-2183 Useless statement in public synchronized List
     new 9f6f36d  ARTEMIS-2183 Fixing RefsOperation on consumers and adding test
     new 299e444  This closes #2567

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../artemis/core/server/impl/RefsOperation.java    |  6 ++-
 .../core/transaction/TransactionDetail.java        |  3 +-
 .../management/ActiveMQServerControlTest.java      | 49 ++++++++++++++++++++++
 3 files changed, 56 insertions(+), 2 deletions(-)


[activemq-artemis] 01/03: ARTEMIS-2183 Useless statement in public synchronized List

Posted by cl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit a1d10c02f99c00527b48e0d17ab8ee5766319999
Author: Otavio R. Piske <an...@gmail.com>
AuthorDate: Mon Feb 25 19:53:41 2019 +0100

    ARTEMIS-2183 Useless statement in public synchronized List
    
    Ensures that the returned list returns the refsToAck list instead of
    trying to add all items of itself
    
    This closes 2566
---
 .../org/apache/activemq/artemis/core/server/impl/RefsOperation.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java
index 3d8bdd6..6d21be2 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java
@@ -191,7 +191,11 @@ public class RefsOperation extends TransactionOperationAbstract {
    @Override
    public synchronized List<MessageReference> getRelatedMessageReferences() {
       List<MessageReference> listRet = new LinkedList<>();
-      listRet.addAll(listRet);
+
+      if (refsToAck != null && !refsToAck.isEmpty()) {
+         listRet.addAll(refsToAck);
+      }
+
       return listRet;
    }
 


[activemq-artemis] 03/03: This closes #2567

Posted by cl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit 299e444009fd0409aa99f7f2800aeed1b89ed014
Merge: 0cf29fe 9f6f36d
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Mon Feb 25 20:11:04 2019 -0500

    This closes #2567

 .../artemis/core/server/impl/RefsOperation.java    |  6 ++-
 .../core/transaction/TransactionDetail.java        |  3 +-
 .../management/ActiveMQServerControlTest.java      | 49 ++++++++++++++++++++++
 3 files changed, 56 insertions(+), 2 deletions(-)


[activemq-artemis] 02/03: ARTEMIS-2183 Fixing RefsOperation on consumers and adding test

Posted by cl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit 9f6f36d0418cded74d2e9b0570726ccabafb2790
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Mon Feb 25 17:23:08 2019 -0500

    ARTEMIS-2183 Fixing RefsOperation on consumers and adding test
---
 .../core/transaction/TransactionDetail.java        |  3 +-
 .../management/ActiveMQServerControlTest.java      | 49 ++++++++++++++++++++++
 2 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/TransactionDetail.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/TransactionDetail.java
index 0ee1b7d..800aec3 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/TransactionDetail.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/TransactionDetail.java
@@ -28,6 +28,7 @@ import java.util.Map;
 import org.apache.activemq.artemis.api.core.JsonUtil;
 import org.apache.activemq.artemis.api.core.Message;
 import org.apache.activemq.artemis.core.server.MessageReference;
+import org.apache.activemq.artemis.core.server.impl.RefsOperation;
 import org.apache.activemq.artemis.core.transaction.impl.XidImpl;
 import org.apache.activemq.artemis.utils.JsonLoader;
 
@@ -83,7 +84,7 @@ public abstract class TransactionDetail {
          String opType = null;
          if (opClassName.equals("org.apache.activemq.artemis.core.postoffice.impl.PostOfficeImpl$AddOperation")) {
             opType = "(+) send";
-         } else if (opClassName.equals("org.apache.activemq.artemis.core.server.impl.QueueImpl$RefsOperation")) {
+         } else if (opClassName.equals(RefsOperation.class.getName())) {
             opType = "(-) receive";
          }
 
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
index 847b01e..5bbb85d 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
@@ -985,6 +985,55 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
    }
 
    @Test
+   public void testListPreparedTransactionDetailsOnConsumer() throws Exception {
+      SimpleString atestq = new SimpleString("BasicXaTestq");
+      Xid xid = newXID();
+
+      ServerLocator locator = createInVMNonHALocator();
+      ClientSessionFactory csf = createSessionFactory(locator);
+      ClientSession clientSession = csf.createSession(true, false, false);
+      clientSession.createQueue(atestq, atestq, null, true);
+
+      ClientMessage m1 = createTextMessage(clientSession, "");
+      ClientMessage m2 = createTextMessage(clientSession, "");
+      ClientMessage m3 = createTextMessage(clientSession, "");
+      ClientMessage m4 = createTextMessage(clientSession, "");
+      m1.putStringProperty("m1", "valuem1");
+      m2.putStringProperty("m2", "valuem2");
+      m3.putStringProperty("m3", "valuem3");
+      m4.putStringProperty("m4", "valuem4");
+      ClientProducer clientProducer = clientSession.createProducer(atestq);
+      clientSession.start(xid, XAResource.TMNOFLAGS);
+      clientProducer.send(m1);
+      clientProducer.send(m2);
+      clientProducer.send(m3);
+      clientProducer.send(m4);
+      clientSession.end(xid, XAResource.TMSUCCESS);
+      clientSession.prepare(xid);
+      clientSession.commit(xid, false);
+
+      ClientConsumer consumer = clientSession.createConsumer(atestq);
+      clientSession.start();
+      xid = newXID();
+      clientSession.start(xid, XAResource.TMNOFLAGS);
+      m1 = consumer.receive(1000);
+      Assert.assertNotNull(m1);
+      m1.acknowledge();
+      clientSession.end(xid, XAResource.TMSUCCESS);
+      clientSession.prepare(xid);
+      ActiveMQServerControl serverControl = createManagementControl();
+      String jsonOutput = serverControl.listPreparedTransactionDetailsAsJSON();
+
+      // just one message is pending, and it should be listed on the output
+      Assert.assertTrue(jsonOutput.lastIndexOf("valuem1") > 0);
+      Assert.assertTrue(jsonOutput.lastIndexOf("valuem2") < 0);
+      Assert.assertTrue(jsonOutput.lastIndexOf("valuem3") < 0);
+      Assert.assertTrue(jsonOutput.lastIndexOf("valuem4") < 0);
+      clientSession.close();
+      locator.close();
+   }
+
+   @Test
    public void testListPreparedTransactionDetailsAsHTML() throws Exception {
       SimpleString atestq = new SimpleString("BasicXaTestq");
       Xid xid = newXID();