You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2018/12/13 20:04:26 UTC
[1/2] activemq-artemis git commit: ARTEMIS-1949 fix
IllegalMonitorStateException during shutdown
Repository: activemq-artemis
Updated Branches:
refs/heads/master e2448753a -> aac7b8373
ARTEMIS-1949 fix IllegalMonitorStateException during shutdown
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/dbbd94bd
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/dbbd94bd
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/dbbd94bd
Branch: refs/heads/master
Commit: dbbd94bd513b415a34370fdc8bfd1f851aa5965d
Parents: e244875
Author: yang wei <wy...@gmail.com>
Authored: Thu Jun 21 15:46:59 2018 +0800
Committer: Justin Bertram <jb...@apache.org>
Committed: Thu Dec 13 14:03:01 2018 -0600
----------------------------------------------------------------------
.../impl/ActiveMQClientProtocolManager.java | 7 +-
.../client/SessionFactoryCloseTest.java | 73 ++++++++++++++++++++
2 files changed, 78 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dbbd94bd/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQClientProtocolManager.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQClientProtocolManager.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQClientProtocolManager.java
index 47401c5..1b8ec97 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQClientProtocolManager.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQClientProtocolManager.java
@@ -169,10 +169,13 @@ public class ActiveMQClientProtocolManager implements ClientProtocolManager {
Lock lock = getChannel1().getLock();
// Lock it - this must be done while the failoverLock is held
- while (isAlive() && !lock.tryLock(100, TimeUnit.MILLISECONDS)) {
+ while (isAlive()) {
+ if (lock.tryLock(100, TimeUnit.MILLISECONDS)) {
+ return lock;
+ }
}
- return lock;
+ return null;
} finally {
localFailoverLock.unlock();
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/dbbd94bd/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionFactoryCloseTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionFactoryCloseTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionFactoryCloseTest.java
new file mode 100644
index 0000000..a8f09f2
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionFactoryCloseTest.java
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.tests.integration.client;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
+import org.apache.activemq.artemis.api.core.client.FailoverEventType;
+import org.apache.activemq.artemis.api.core.client.ServerLocator;
+import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SessionFactoryCloseTest extends ActiveMQTestBase {
+
+ private ActiveMQServer server;
+
+ @Before
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ server = createServer(false);
+
+ server.start();
+ }
+
+ @Test
+ public void testCloseSessionFactory() throws Exception {
+ ServerLocator locator = createInVMNonHALocator().setReconnectAttempts(-1).setConnectionTTL(1000).setClientFailureCheckPeriod(100).setConsumerWindowSize(10 * 1024 * 1024).setCallTimeout(1000);
+ ClientSessionFactory sf = locator.createSessionFactory();
+
+ final CountDownLatch latch = new CountDownLatch(1);
+ sf.addFailoverListener(eventType -> {
+ if (eventType == FailoverEventType.FAILURE_DETECTED) {
+ try {
+ /**
+ * We close client session factory during this period and
+ * expect reconnection stopped without exception which notifies
+ * FAILOVER_FAILED event. See ARTEMIS-1949.
+ */
+ Thread.sleep(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ } else if (eventType == FailoverEventType.FAILOVER_FAILED) {
+ latch.countDown();
+ }
+ });
+ server.stop();
+
+ Thread.sleep(600);
+ sf.close();
+ assertTrue(latch.await(1000, TimeUnit.MILLISECONDS));
+ }
+}
[2/2] activemq-artemis git commit: This closes #2155
Posted by jb...@apache.org.
This closes #2155
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/aac7b837
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/aac7b837
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/aac7b837
Branch: refs/heads/master
Commit: aac7b8373f27b29c4d1128c494d0b6caef3fd148
Parents: e244875 dbbd94b
Author: Justin Bertram <jb...@apache.org>
Authored: Thu Dec 13 14:03:02 2018 -0600
Committer: Justin Bertram <jb...@apache.org>
Committed: Thu Dec 13 14:03:02 2018 -0600
----------------------------------------------------------------------
.../impl/ActiveMQClientProtocolManager.java | 7 +-
.../client/SessionFactoryCloseTest.java | 73 ++++++++++++++++++++
2 files changed, 78 insertions(+), 2 deletions(-)
----------------------------------------------------------------------