You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2017/04/10 16:43:54 UTC
qpid-jms git commit: QPIDJMS-285 Throw a
TransactionRolledBackException on commit if offline
Repository: qpid-jms
Updated Branches:
refs/heads/master 69ca225f6 -> 704817ddb
QPIDJMS-285 Throw a TransactionRolledBackException on commit if offline
When the FailoverProvider throws from commit for the offline state we
should throw TransactionRolledBackException to indicate the TX has
failed.
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/704817dd
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/704817dd
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/704817dd
Branch: refs/heads/master
Commit: 704817ddbb45328df855c3c29b2cac18f2298ba2
Parents: 69ca225
Author: Timothy Bish <ta...@gmail.com>
Authored: Mon Apr 10 12:43:36 2017 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Mon Apr 10 12:43:36 2017 -0400
----------------------------------------------------------------------
.../jms/provider/failover/FailoverProvider.java | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/704817dd/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java
index d94da2a..73708fb 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java
@@ -34,6 +34,7 @@ import java.util.concurrent.atomic.AtomicReference;
import javax.jms.JMSException;
import javax.jms.JMSSecurityException;
+import javax.jms.TransactionRolledBackException;
import org.apache.qpid.jms.JmsOperationTimedOutException;
import org.apache.qpid.jms.JmsSendTimedOutException;
@@ -436,6 +437,13 @@ public class FailoverProvider extends DefaultProviderListener implements Provide
public String toString() {
return "TX commit -> " + transactionInfo.getId();
}
+
+ @Override
+ protected Exception createOfflineFailureException(IOException error) {
+ Exception ex = new TransactionRolledBackException("Commit failed, connection offline: " + error.getMessage());
+ ex.initCause(error);
+ return ex;
+ }
};
serializer.execute(pending);
@@ -1197,14 +1205,18 @@ public class FailoverProvider extends DefaultProviderListener implements Provide
}
}
- public JMSException createTimedOutException() {
+ protected JMSException createTimedOutException() {
return new JmsOperationTimedOutException("Timed out waiting on " + this);
}
+ protected Exception createOfflineFailureException(IOException error) {
+ return IOExceptionSupport.create(error);
+ }
+
private void whenOffline(IOException error) {
if (failureWhenOffline()) {
requests.remove(id);
- getWrappedRequest().onFailure(IOExceptionSupport.create(error));
+ getWrappedRequest().onFailure(createOfflineFailureException(error));
} else if (succeedsWhenOffline()) {
onSuccess();
} else {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org