activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject activemq git commit: AMQ-6362 - merge duplicated code - fix regression in AMQ4889Test and ExceptionListenerTest
Date Mon, 25 Jul 2016 13:27:52 GMT
Repository: activemq
Updated Branches:
  refs/heads/master ad657cc20 -> a65f5e7c2


AMQ-6362 - merge duplicated code - fix regression in AMQ4889Test and ExceptionListenerTest


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

Branch: refs/heads/master
Commit: a65f5e7c2077e048a2664339f6425d73948d71ce
Parents: ad657cc
Author: gtully <gary.tully@gmail.com>
Authored: Mon Jul 25 14:27:40 2016 +0100
Committer: gtully <gary.tully@gmail.com>
Committed: Mon Jul 25 14:27:40 2016 +0100

----------------------------------------------------------------------
 .../org/apache/activemq/ActiveMQConnection.java | 36 ++++----------------
 .../org/apache/activemq/TransactionContext.java |  2 +-
 2 files changed, 8 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/a65f5e7c/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnection.java
----------------------------------------------------------------------
diff --git a/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnection.java b/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnection.java
index 2faa5e2..1f360cb 100755
--- a/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnection.java
+++ b/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnection.java
@@ -685,7 +685,7 @@ public class ActiveMQConnection implements Connection, TopicConnection,
QueueCon
                             RemoveInfo removeCommand = info.createRemoveCommand();
                             removeCommand.setLastDeliveredSequenceId(lastDeliveredSequenceId);
                             try {
-                                doSyncSendPacket(removeCommand, closeTimeout);
+                                syncSendPacket(removeCommand, closeTimeout);
                             } catch (JMSException e) {
                                 if (e.getCause() instanceof RequestTimedOutIOException) {
                                     // expected
@@ -1377,13 +1377,15 @@ public class ActiveMQConnection implements Connection, TopicConnection,
QueueCon
         onException(new IOException("Force close due to SecurityException on connect", exception));
     }
 
-    public Response syncSendPacket(Command command) throws JMSException {
+    public Response syncSendPacket(Command command, int timeout) throws JMSException {
         if (isClosed()) {
             throw new ConnectionClosedException();
         } else {
 
             try {
-                Response response = (Response)this.transport.request(command);
+                Response response = (Response)(timeout > 0
+                        ? this.transport.request(command, timeout)
+                        : this.transport.request(command));
                 if (response.isException()) {
                     ExceptionResponse er = (ExceptionResponse)response;
                     if (er.getException() instanceof JMSException) {
@@ -1422,32 +1424,8 @@ public class ActiveMQConnection implements Connection, TopicConnection,
QueueCon
      *
      * @throws JMSException
      */
-    public Response syncSendPacket(Command command, int timeout) throws JMSException {
-        if (isClosed() || closing.get()) {
-            throw new ConnectionClosedException();
-        } else {
-            return doSyncSendPacket(command, timeout);
-        }
-    }
-
-    protected Response doSyncSendPacket(Command command, int timeout)
-            throws JMSException {
-        try {
-            Response response = (Response) (timeout > 0
-                    ? this.transport.request(command, timeout)
-                    : this.transport.request(command));
-            if (response != null && response.isException()) {
-                ExceptionResponse er = (ExceptionResponse)response;
-                if (er.getException() instanceof JMSException) {
-                    throw (JMSException)er.getException();
-                } else {
-                    throw JMSExceptionSupport.create(er.getException());
-                }
-            }
-            return response;
-        } catch (IOException e) {
-            throw JMSExceptionSupport.create(e);
-        }
+    public Response syncSendPacket(Command command) throws JMSException {
+        return syncSendPacket(command, 0);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/activemq/blob/a65f5e7c/activemq-client/src/main/java/org/apache/activemq/TransactionContext.java
----------------------------------------------------------------------
diff --git a/activemq-client/src/main/java/org/apache/activemq/TransactionContext.java b/activemq-client/src/main/java/org/apache/activemq/TransactionContext.java
index efe12c4..2188ff9 100755
--- a/activemq-client/src/main/java/org/apache/activemq/TransactionContext.java
+++ b/activemq-client/src/main/java/org/apache/activemq/TransactionContext.java
@@ -277,7 +277,7 @@ public class TransactionContext implements XAResource {
             TransactionInfo info = new TransactionInfo(getConnectionId(), transactionId,
TransactionInfo.ROLLBACK);
             this.transactionId = null;
             //make this synchronous - see https://issues.apache.org/activemq/browse/AMQ-2364
-            this.connection.doSyncSendPacket(info, this.connection.isClosing() ? this.connection.getCloseTimeout()
: 0);
+            this.connection.syncSendPacket(info, this.connection.isClosing() ? this.connection.getCloseTimeout()
: 0);
             // Notify the listener that the tx was rolled back
             if (localTransactionEventListener != null) {
                 localTransactionEventListener.rollbackEvent();


Mime
View raw message