You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ha...@apache.org on 2014/03/20 21:15:48 UTC
[18/19] git commit: AMQ-5090 - improve transaction tracking
AMQ-5090 - improve transaction tracking
Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/1236ba41
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/1236ba41
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/1236ba41
Branch: refs/heads/activemq-5.9
Commit: 1236ba41569e7c99e9c28eddc6cf079e1e0476df
Parents: bfe2382
Author: Hadrian Zbarcea <ha...@apache.org>
Authored: Thu Mar 20 15:20:58 2014 -0400
Committer: Hadrian Zbarcea <ha...@apache.org>
Committed: Thu Mar 20 15:20:58 2014 -0400
----------------------------------------------------------------------
.../apache/activemq/state/ConnectionStateTracker.java | 10 +++++-----
.../activemq/transport/failover/FailoverTransport.java | 11 ++++++++---
2 files changed, 13 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq/blob/1236ba41/activemq-client/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java
----------------------------------------------------------------------
diff --git a/activemq-client/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java b/activemq-client/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java
index effbc83..2a0cbb9 100755
--- a/activemq-client/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java
+++ b/activemq-client/src/main/java/org/apache/activemq/state/ConnectionStateTracker.java
@@ -537,7 +537,7 @@ public class ConnectionStateTracker extends CommandVisitorAdapter {
@Override
public Response processPrepareTransaction(TransactionInfo info) throws Exception {
- if (trackTransactions && info != null) {
+ if (trackTransactions && info != null && info.getTransactionId() != null) {
ConnectionId connectionId = info.getConnectionId();
if (connectionId != null) {
ConnectionState cs = connectionStates.get(connectionId);
@@ -555,7 +555,7 @@ public class ConnectionStateTracker extends CommandVisitorAdapter {
@Override
public Response processCommitTransactionOnePhase(TransactionInfo info) throws Exception {
- if (trackTransactions && info != null) {
+ if (trackTransactions && info != null && info.getTransactionId() != null) {
ConnectionId connectionId = info.getConnectionId();
if (connectionId != null) {
ConnectionState cs = connectionStates.get(connectionId);
@@ -573,7 +573,7 @@ public class ConnectionStateTracker extends CommandVisitorAdapter {
@Override
public Response processCommitTransactionTwoPhase(TransactionInfo info) throws Exception {
- if (trackTransactions && info != null) {
+ if (trackTransactions && info != null && info.getTransactionId() != null) {
ConnectionId connectionId = info.getConnectionId();
if (connectionId != null) {
ConnectionState cs = connectionStates.get(connectionId);
@@ -591,7 +591,7 @@ public class ConnectionStateTracker extends CommandVisitorAdapter {
@Override
public Response processRollbackTransaction(TransactionInfo info) throws Exception {
- if (trackTransactions && info != null) {
+ if (trackTransactions && info != null && info.getTransactionId() != null) {
ConnectionId connectionId = info.getConnectionId();
if (connectionId != null) {
ConnectionState cs = connectionStates.get(connectionId);
@@ -609,7 +609,7 @@ public class ConnectionStateTracker extends CommandVisitorAdapter {
@Override
public Response processEndTransaction(TransactionInfo info) throws Exception {
- if (trackTransactions && info != null) {
+ if (trackTransactions && info != null && info.getTransactionId() != null) {
ConnectionId connectionId = info.getConnectionId();
if (connectionId != null) {
ConnectionState cs = connectionStates.get(connectionId);
http://git-wip-us.apache.org/repos/asf/activemq/blob/1236ba41/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
----------------------------------------------------------------------
diff --git a/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java b/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
index e9ce12c..2829d41 100755
--- a/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
+++ b/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
@@ -257,8 +257,8 @@ public class FailoverTransport implements CompositeTransport {
if (canReconnect()) {
reconnectOk = true;
}
- LOG.warn("Transport (" + transport.getRemoteAddress() + ") failed, reason: " + e
- + (reconnectOk ? "," : ", not") + " attempting to automatically reconnect");
+ LOG.warn("Transport (" + transport + ") failed, reason: "
+ + (reconnectOk ? "," : ", not") + " attempting to automatically reconnect", e);
initialized = false;
failedConnectTransportURI = connectedTransportURI;
@@ -635,11 +635,16 @@ public class FailoverTransport implements CompositeTransport {
break;
}
+ Tracked tracked = null;
+ try {
+ tracked = stateTracker.track(command);
+ } catch (IOException ioe) {
+ LOG.debug("Cannot track the command " + command, ioe);
+ }
// If it was a request and it was not being tracked by
// the state tracker,
// then hold it in the requestMap so that we can replay
// it later.
- Tracked tracked = stateTracker.track(command);
synchronized (requestMap) {
if (tracked != null && tracked.isWaitingForResponse()) {
requestMap.put(Integer.valueOf(command.getCommandId()), tracked);