activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/2] activemq-artemis git commit: ARTEMIS-288 Start close method in separate executor
Date Thu, 29 Oct 2015 15:31:39 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 2cc2e29b1 -> 8aaed7568


ARTEMIS-288 Start close method in separate executor

When server sends disconnect to the client, the ClientSession schedules
a close task on it's ordered executor.  Once the close method starts
it's waits to check to see if all jobs in it's executor has completed.
To do this it adds a job to it's ordered executor, once it is run it
knows there is nothing more to do and thus is ready to close.  However,
this causes a deadlock as both jobs are running in the ordered executor
and thus are both waiting on each other.  The close eventually timesout
which is why we see the logs as reported in the JIRA.

This commit runs the close method in it's own ordered executor, thus
preventing the two jobs blocking each other.


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

Branch: refs/heads/master
Commit: 26898e4663ce00468ec9cebf00c57d72658dd191
Parents: 2cc2e29
Author: Martyn Taylor <mtaylor@redhat.com>
Authored: Thu Oct 29 12:50:08 2015 +0000
Committer: Martyn Taylor <mtaylor@redhat.com>
Committed: Thu Oct 29 14:34:19 2015 +0000

----------------------------------------------------------------------
 .../artemis/core/client/impl/ClientSessionFactoryImpl.java  | 2 +-
 .../artemis/core/client/impl/ClientSessionImpl.java         | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/26898e46/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java
index 3902fd3..07a51e4 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java
@@ -642,7 +642,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal,
C
 
       SessionContext context = createSessionChannel(name, username, password, xa, autoCommitSends,
autoCommitAcks, preAcknowledge);
 
-      ClientSessionInternal session = new ClientSessionImpl(this, name, username, password,
xa, autoCommitSends, autoCommitAcks, preAcknowledge, serverLocator.isBlockOnAcknowledge(),
serverLocator.isAutoGroup(), ackBatchSize, serverLocator.getConsumerWindowSize(), serverLocator.getConsumerMaxRate(),
serverLocator.getConfirmationWindowSize(), serverLocator.getProducerWindowSize(), serverLocator.getProducerMaxRate(),
serverLocator.isBlockOnNonDurableSend(), serverLocator.isBlockOnDurableSend(), serverLocator.isCacheLargeMessagesClient(),
serverLocator.getMinLargeMessageSize(), serverLocator.isCompressLargeMessage(), serverLocator.getInitialMessagePacketSize(),
serverLocator.getGroupID(), context, orderedExecutorFactory.getExecutor(), orderedExecutorFactory.getExecutor());
+      ClientSessionInternal session = new ClientSessionImpl(this, name, username, password,
xa, autoCommitSends, autoCommitAcks, preAcknowledge, serverLocator.isBlockOnAcknowledge(),
serverLocator.isAutoGroup(), ackBatchSize, serverLocator.getConsumerWindowSize(), serverLocator.getConsumerMaxRate(),
serverLocator.getConfirmationWindowSize(), serverLocator.getProducerWindowSize(), serverLocator.getProducerMaxRate(),
serverLocator.isBlockOnNonDurableSend(), serverLocator.isBlockOnDurableSend(), serverLocator.isCacheLargeMessagesClient(),
serverLocator.getMinLargeMessageSize(), serverLocator.isCompressLargeMessage(), serverLocator.getInitialMessagePacketSize(),
serverLocator.getGroupID(), context, orderedExecutorFactory.getExecutor(), orderedExecutorFactory.getExecutor(),
orderedExecutorFactory.getExecutor());
 
       synchronized (sessions) {
          if (closed || !clientProtocolManager.isAlive()) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/26898e46/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
index acb0725..93618af 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java
@@ -142,6 +142,8 @@ public final class ClientSessionImpl implements ClientSessionInternal,
FailureLi
 
    private final ConfirmationWindowWarning confirmationWindowWarning;
 
+   private final Executor closeExecutor;
+
    ClientSessionImpl(final ClientSessionFactoryInternal sessionFactory,
                      final String name,
                      final String username,
@@ -167,7 +169,8 @@ public final class ClientSessionImpl implements ClientSessionInternal,
FailureLi
                      final String groupID,
                      final SessionContext sessionContext,
                      final Executor executor,
-                     final Executor flowControlExecutor) throws ActiveMQException {
+                     final Executor flowControlExecutor,
+                     final Executor closeExecutor) throws ActiveMQException {
       this.sessionFactory = sessionFactory;
 
       this.name = name;
@@ -223,6 +226,8 @@ public final class ClientSessionImpl implements ClientSessionInternal,
FailureLi
       sessionContext.setSession(this);
 
       confirmationWindowWarning = sessionFactory.getConfirmationWindowWarning();
+
+      this.closeExecutor = closeExecutor;
    }
 
    // ClientSession implementation
@@ -768,7 +773,7 @@ public final class ClientSessionImpl implements ClientSessionInternal,
FailureLi
       final ClientConsumerInternal consumer = getConsumer(context);
 
       if (consumer != null) {
-         executor.execute(new Runnable() {
+         closeExecutor.execute(new Runnable() {
             @Override
             public void run() {
                try {


Mime
View raw message