You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2015/04/09 21:16:55 UTC

[1/5] activemq-6 git commit: Fixing race on PageSubscriptionImpl

Repository: activemq-6
Updated Branches:
  refs/heads/master 238b2fe09 -> d9c9fc0e9


Fixing race on PageSubscriptionImpl

I have seen a NPE in a few unit tests that were caused by currenDelivery changing between these two steps:

i - if (currentDelivery != null)
ii - .... currentDelivery.getPos();

instead of adding extra synchronization I'm caching the currentValue what would been enough on this case.

This is just to avoid NPEs


Project: http://git-wip-us.apache.org/repos/asf/activemq-6/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-6/commit/41b823be
Tree: http://git-wip-us.apache.org/repos/asf/activemq-6/tree/41b823be
Diff: http://git-wip-us.apache.org/repos/asf/activemq-6/diff/41b823be

Branch: refs/heads/master
Commit: 41b823be7ebcb83d0f8f24e805b6f4433ce5a049
Parents: 238b2fe
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu Apr 9 14:59:56 2015 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Apr 9 15:00:20 2015 -0400

----------------------------------------------------------------------
 .../core/paging/cursor/impl/PageSubscriptionImpl.java         | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-6/blob/41b823be/activemq-server/src/main/java/org/apache/activemq/core/paging/cursor/impl/PageSubscriptionImpl.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/main/java/org/apache/activemq/core/paging/cursor/impl/PageSubscriptionImpl.java b/activemq-server/src/main/java/org/apache/activemq/core/paging/cursor/impl/PageSubscriptionImpl.java
index 42eeed8..5bf36e6 100644
--- a/activemq-server/src/main/java/org/apache/activemq/core/paging/cursor/impl/PageSubscriptionImpl.java
+++ b/activemq-server/src/main/java/org/apache/activemq/core/paging/cursor/impl/PageSubscriptionImpl.java
@@ -1471,12 +1471,13 @@ final class PageSubscriptionImpl implements PageSubscription
       public void remove()
       {
          deliveredCount.incrementAndGet();
-         if (currentDelivery != null)
+         PagedReference delivery = currentDelivery;
+         if (delivery != null)
          {
-            PageCursorInfo info = PageSubscriptionImpl.this.getPageInfo(currentDelivery.getPosition());
+            PageCursorInfo info = PageSubscriptionImpl.this.getPageInfo(delivery.getPosition());
             if (info != null)
             {
-               info.remove(currentDelivery.getPosition());
+               info.remove(delivery.getPosition());
             }
          }
       }


[2/5] activemq-6 git commit: Fixing a NPE case after Duplciate detection

Posted by jb...@apache.org.
Fixing a NPE case after Duplciate detection

If a Transaction wasn't created, the case for duplciate Detection would cancel a transaction that never happened
and it would get a NPE instead of a TX Exception.

It wasn't a big deal as the client got an exception anyways and the users were able to cancel in that case
but the message sent was a string containing just "Null".

this will fix it with a proper handling


Project: http://git-wip-us.apache.org/repos/asf/activemq-6/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-6/commit/2154c754
Tree: http://git-wip-us.apache.org/repos/asf/activemq-6/tree/2154c754
Diff: http://git-wip-us.apache.org/repos/asf/activemq-6/diff/2154c754

Branch: refs/heads/master
Commit: 2154c754c850568988251d8c04ebfabdd41d9aee
Parents: 41b823b
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu Apr 9 15:00:06 2015 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Apr 9 15:03:47 2015 -0400

----------------------------------------------------------------------
 .../apache/activemq/core/transaction/impl/TransactionImpl.java  | 5 ++++-
 .../activemq/tests/integration/DuplicateDetectionTest.java      | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-6/blob/2154c754/activemq-server/src/main/java/org/apache/activemq/core/transaction/impl/TransactionImpl.java
----------------------------------------------------------------------
diff --git a/activemq-server/src/main/java/org/apache/activemq/core/transaction/impl/TransactionImpl.java b/activemq-server/src/main/java/org/apache/activemq/core/transaction/impl/TransactionImpl.java
index 2511e4e..4697fba 100644
--- a/activemq-server/src/main/java/org/apache/activemq/core/transaction/impl/TransactionImpl.java
+++ b/activemq-server/src/main/java/org/apache/activemq/core/transaction/impl/TransactionImpl.java
@@ -167,7 +167,10 @@ public class TransactionImpl implements Transaction
                   // so we reset it now
                   beforeRollback();
                   afterRollback();
-                  operations.clear();
+                  if (operations != null)
+                  {
+                     operations.clear();
+                  }
                   throw exception;
                }
                else

http://git-wip-us.apache.org/repos/asf/activemq-6/blob/2154c754/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/DuplicateDetectionTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/DuplicateDetectionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/DuplicateDetectionTest.java
index 3fe9ad0..486a552 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/DuplicateDetectionTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/DuplicateDetectionTest.java
@@ -1245,6 +1245,7 @@ public class DuplicateDetectionTest extends ServiceTestBase
       }
       catch (XAException expected)
       {
+         assertTrue(expected.getCause().toString().contains("DUPLICATE_ID_REJECTED"));
       }
 
       session.rollback(xid2);


[4/5] activemq-6 git commit: Increase version of logging processor

Posted by jb...@apache.org.
Increase version of logging processor

There's a bug I found on logging processor, that it's being fixed at alpha2
https://issues.jboss.org/browse/LOGTOOL-88
https://issues.jboss.org/browse/LOGTOOL-87


Project: http://git-wip-us.apache.org/repos/asf/activemq-6/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-6/commit/2fa74d01
Tree: http://git-wip-us.apache.org/repos/asf/activemq-6/tree/2fa74d01
Diff: http://git-wip-us.apache.org/repos/asf/activemq-6/diff/2fa74d01

Branch: refs/heads/master
Commit: 2fa74d01578c924f7059b6d6ab186290b2d57275
Parents: abeb0bf
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon Apr 6 11:38:59 2015 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Apr 9 15:05:27 2015 -0400

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-6/blob/2fa74d01/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 9ca249a..c1e5b1b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -203,7 +203,7 @@
          <dependency>
             <groupId>org.jboss.logging</groupId>
             <artifactId>jboss-logging-processor</artifactId>
-            <version>2.0.0.Alpha1</version>
+            <version>2.0.0.Alpha2</version>
             <optional>true</optional>
             <!-- License: LGPL-->
          </dependency>


[5/5] activemq-6 git commit: This closes #203 - fixes mainly for test-suite

Posted by jb...@apache.org.
This closes #203 - fixes mainly for test-suite


Project: http://git-wip-us.apache.org/repos/asf/activemq-6/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-6/commit/d9c9fc0e
Tree: http://git-wip-us.apache.org/repos/asf/activemq-6/tree/d9c9fc0e
Diff: http://git-wip-us.apache.org/repos/asf/activemq-6/diff/d9c9fc0e

Branch: refs/heads/master
Commit: d9c9fc0e9e1f51d4700b4d4e11b3cb57f49b6f62
Parents: 238b2fe 2fa74d0
Author: jbertram <jb...@redhat.com>
Authored: Thu Apr 9 14:14:52 2015 -0500
Committer: jbertram <jb...@redhat.com>
Committed: Thu Apr 9 14:14:52 2015 -0500

----------------------------------------------------------------------
 .../cursor/impl/PageSubscriptionImpl.java       |  7 ++++---
 .../core/transaction/impl/TransactionImpl.java  |  5 ++++-
 pom.xml                                         |  2 +-
 .../integration/DuplicateDetectionTest.java     |  1 +
 .../integration/client/HangConsumerTest.java    | 20 +++++++++-----------
 5 files changed, 19 insertions(+), 16 deletions(-)
----------------------------------------------------------------------



[3/5] activemq-6 git commit: Improving test timing

Posted by jb...@apache.org.
Improving test timing

HangConsumerTest was hanging for 20 seconds for no real reason. this change will improve the timing on the test


Project: http://git-wip-us.apache.org/repos/asf/activemq-6/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-6/commit/abeb0bf3
Tree: http://git-wip-us.apache.org/repos/asf/activemq-6/tree/abeb0bf3
Diff: http://git-wip-us.apache.org/repos/asf/activemq-6/diff/abeb0bf3

Branch: refs/heads/master
Commit: abeb0bf3c248a01dafff9d19d02231dfe087d3a6
Parents: 2154c75
Author: Clebert Suconic <cl...@apache.org>
Authored: Thu Apr 2 15:22:56 2015 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Thu Apr 9 15:05:19 2015 -0400

----------------------------------------------------------------------
 .../integration/client/HangConsumerTest.java    | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-6/blob/abeb0bf3/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/HangConsumerTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/HangConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/HangConsumerTest.java
index fb56440..1b6349a 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/HangConsumerTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/tests/integration/client/HangConsumerTest.java
@@ -15,12 +15,7 @@
  * limitations under the License.
  */
 package org.apache.activemq.tests.integration.client;
-import org.apache.activemq.api.core.ActiveMQException;
-import org.apache.activemq.core.server.ServerConsumer;
-import org.junit.Before;
-import org.junit.After;
-import org.junit.Test;
-
+import javax.management.MBeanServer;
 import java.lang.management.ManagementFactory;
 import java.util.LinkedList;
 import java.util.concurrent.CountDownLatch;
@@ -29,9 +24,7 @@ import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 
-import javax.management.MBeanServer;
-
-import org.junit.Assert;
+import org.apache.activemq.api.core.ActiveMQException;
 import org.apache.activemq.api.core.Interceptor;
 import org.apache.activemq.api.core.SimpleString;
 import org.apache.activemq.api.core.client.ClientConsumer;
@@ -56,6 +49,7 @@ import org.apache.activemq.core.protocol.core.Packet;
 import org.apache.activemq.core.protocol.core.impl.wireformat.SessionReceiveMessage;
 import org.apache.activemq.core.server.ActiveMQServer;
 import org.apache.activemq.core.server.Queue;
+import org.apache.activemq.core.server.ServerConsumer;
 import org.apache.activemq.core.server.ServerMessage;
 import org.apache.activemq.core.server.ServerSessionFactory;
 import org.apache.activemq.core.server.impl.ActiveMQServerImpl;
@@ -72,6 +66,10 @@ import org.apache.activemq.spi.core.security.ActiveMQSecurityManagerImpl;
 import org.apache.activemq.tests.util.ServiceTestBase;
 import org.apache.activemq.utils.ExecutorFactory;
 import org.apache.activemq.utils.ReusableLatch;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * This test will simulate a consumer hanging on the delivery packet due to unbehaved clients
@@ -150,8 +148,8 @@ public class HangConsumerTest extends ServiceTestBase
          sessionProducer.commit();
 
          // These three operations should finish without the test hanging
-         getMessagesAdded(queue);
-         getMessageCount(queue);
+         queue.getMessagesAdded();
+         queue.getMessageCount();
 
          releaseConsumers();