activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject [01/19] git commit: avoid ugly npe post endpoint disassociate and add additional trace to recovery
Date Thu, 20 Mar 2014 20:15:31 GMT
Repository: activemq
Updated Branches:
  refs/heads/activemq-5.9 ad324538c -> e671e82c5


avoid ugly npe post endpoint disassociate and add additional trace to recovery


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

Branch: refs/heads/activemq-5.9
Commit: afe0f18fabf2708d9514685c301917273dcdc59f
Parents: ad32453
Author: gtully <gary.tully@gmail.com>
Authored: Mon Feb 17 14:36:40 2014 +0000
Committer: Hadrian Zbarcea <hadrian@apache.org>
Committed: Thu Mar 20 14:46:33 2014 -0400

----------------------------------------------------------------------
 .../activemq/ra/ActiveMQEndpointWorker.java       | 18 +++++++++---------
 .../apache/activemq/ra/LocalAndXATransaction.java |  5 ++++-
 .../apache/activemq/ra/ServerSessionPoolImpl.java |  8 +++++++-
 3 files changed, 20 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/afe0f18f/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java
----------------------------------------------------------------------
diff --git a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java
b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java
index b18ef29..1e12751 100755
--- a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java
+++ b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java
@@ -294,18 +294,18 @@ public class ActiveMQEndpointWorker {
 
     private void connect() {
         synchronized ( connectWork ) {
-        if (!running) {
-            return;
-        }
+            if (!running) {
+                return;
+            }
 
-        try {
-            workManager.scheduleWork(connectWork, WorkManager.INDEFINITE, null, null);
-        } catch (WorkException e) {
-            running = false;
-            LOG.error("Work Manager did not accept work: ", e);
+            try {
+                workManager.scheduleWork(connectWork, WorkManager.INDEFINITE, null, null);
+            } catch (WorkException e) {
+                running = false;
+                LOG.error("Work Manager did not accept work: ", e);
+            }
         }
     }
-    }
 
     /**
      * 

http://git-wip-us.apache.org/repos/asf/activemq/blob/afe0f18f/activemq-ra/src/main/java/org/apache/activemq/ra/LocalAndXATransaction.java
----------------------------------------------------------------------
diff --git a/activemq-ra/src/main/java/org/apache/activemq/ra/LocalAndXATransaction.java b/activemq-ra/src/main/java/org/apache/activemq/ra/LocalAndXATransaction.java
index 0f27393..c6d91ef 100755
--- a/activemq-ra/src/main/java/org/apache/activemq/ra/LocalAndXATransaction.java
+++ b/activemq-ra/src/main/java/org/apache/activemq/ra/LocalAndXATransaction.java
@@ -127,7 +127,10 @@ public class LocalAndXATransaction implements XAResource, LocalTransaction
{
     }
 
     public Xid[] recover(int arg0) throws XAException {
-        return transactionContext.recover(arg0);
+        Xid[] answer = null;
+        answer = transactionContext.recover(arg0);
+        LOG.trace("{} recover({}) = {}", new Object[]{this, arg0, answer});
+        return answer;
     }
 
     public void rollback(Xid arg0) throws XAException {

http://git-wip-us.apache.org/repos/asf/activemq/blob/afe0f18f/activemq-ra/src/main/java/org/apache/activemq/ra/ServerSessionPoolImpl.java
----------------------------------------------------------------------
diff --git a/activemq-ra/src/main/java/org/apache/activemq/ra/ServerSessionPoolImpl.java b/activemq-ra/src/main/java/org/apache/activemq/ra/ServerSessionPoolImpl.java
index c0c3320..25de03d 100755
--- a/activemq-ra/src/main/java/org/apache/activemq/ra/ServerSessionPoolImpl.java
+++ b/activemq-ra/src/main/java/org/apache/activemq/ra/ServerSessionPoolImpl.java
@@ -30,6 +30,7 @@ import javax.jms.Session;
 import javax.resource.spi.UnavailableException;
 import javax.resource.spi.endpoint.MessageEndpoint;
 
+import org.apache.activemq.ActiveMQConnection;
 import org.apache.activemq.ActiveMQQueueSession;
 import org.apache.activemq.ActiveMQSession;
 import org.apache.activemq.ActiveMQTopicSession;
@@ -60,7 +61,12 @@ public class ServerSessionPoolImpl implements ServerSessionPool {
     private ServerSessionImpl createServerSessionImpl() throws JMSException {
         MessageActivationSpec activationSpec = activeMQAsfEndpointWorker.endpointActivationKey.getActivationSpec();
         int acknowledge = (activeMQAsfEndpointWorker.transacted) ? Session.SESSION_TRANSACTED
: activationSpec.getAcknowledgeModeForSession();
-        final ActiveMQSession session = (ActiveMQSession)activeMQAsfEndpointWorker.getConnection().createSession(activeMQAsfEndpointWorker.transacted,
acknowledge);
+        final ActiveMQConnection connection = activeMQAsfEndpointWorker.getConnection();
+        if (connection == null) {
+            // redispatch of pending prefetched messages after disconnect can have a null
connection
+            return null;
+        }
+        final ActiveMQSession session = (ActiveMQSession)connection.createSession(activeMQAsfEndpointWorker.transacted,
acknowledge);
         MessageEndpoint endpoint;
         try {
             int batchSize = 0;


Mime
View raw message