You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2016/03/09 20:43:18 UTC

[55/58] [abbrv] activemq-artemis git commit: looking for leaking server

looking for leaking server


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

Branch: refs/heads/refactor-openwire
Commit: df323bc7d1abf3b0485d96f5250a505d48bae82b
Parents: 1d7f0f6
Author: Clebert Suconic <cl...@apache.org>
Authored: Fri Mar 4 17:21:56 2016 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Mar 9 14:41:41 2016 -0500

----------------------------------------------------------------------
 tests/activemq5-unit-tests/pom.xml              |  9 ++++
 .../artemiswrapper/CleanupThreadRule.java       | 52 ++++++++++++++++++++
 .../artemiswrapper/OpenwireArtemisBaseTest.java |  7 +++
 .../transport/failover/ClusterUtil.java         | 25 ----------
 4 files changed, 68 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/df323bc7/tests/activemq5-unit-tests/pom.xml
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/pom.xml b/tests/activemq5-unit-tests/pom.xml
index a17847e..bbfbcd3 100644
--- a/tests/activemq5-unit-tests/pom.xml
+++ b/tests/activemq5-unit-tests/pom.xml
@@ -49,6 +49,14 @@
 
    <dependencies>
 
+      <!-- I imported this to get the ThreadLeakCheck -->
+      <dependency>
+         <groupId>org.apache.activemq</groupId>
+         <artifactId>artemis-server</artifactId>
+         <version>${project.version}</version>
+         <type>test-jar</type>
+      </dependency>
+
       <dependency>
          <groupId>org.apache.activemq</groupId>
          <artifactId>activemq-client</artifactId>
@@ -336,6 +344,7 @@
             </exclusion>
          </exclusions>
       </dependency>
+
        <!--
            JBoss Logging
        -->

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/df323bc7/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/CleanupThreadRule.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/CleanupThreadRule.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/CleanupThreadRule.java
new file mode 100644
index 0000000..2ddac3b
--- /dev/null
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/CleanupThreadRule.java
@@ -0,0 +1,52 @@
+/**
+ * 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.broker.artemiswrapper;
+
+import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl;
+import org.apache.activemq.artemis.core.persistence.impl.journal.OperationContextImpl;
+import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector;
+import org.junit.rules.ExternalResource;
+
+public class CleanupThreadRule extends ExternalResource {
+
+   @Override
+   protected void before() throws Throwable {
+
+   }
+
+   @Override
+   protected void after() {
+      OperationContextImpl.clearContext();
+
+      // We shutdown the global pools to give a better isolation between tests
+      try {
+         ServerLocatorImpl.clearThreadPools();
+      }
+      catch (Throwable e) {
+         e.printStackTrace();
+      }
+
+      try {
+         NettyConnector.clearThreadPools();
+      }
+      catch (Exception e) {
+         e.printStackTrace();
+      }
+
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/df323bc7/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java
index 5c8d3b6..2f3a330 100644
--- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java
+++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/OpenwireArtemisBaseTest.java
@@ -33,6 +33,7 @@ import org.apache.activemq.artemis.core.server.JournalType;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl;
 import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
+import org.apache.activemq.artemis.tests.util.ThreadLeakCheckRule;
 import org.apache.activemq.artemis.utils.uri.URISchema;
 import org.apache.activemq.artemis.utils.uri.URISupport;
 import org.apache.activemq.broker.BrokerService;
@@ -48,6 +49,12 @@ import javax.management.ObjectName;
 public class OpenwireArtemisBaseTest {
 
    @Rule
+   public CleanupThreadRule cleanupRules = new CleanupThreadRule();
+
+   @Rule
+   public ThreadLeakCheckRule leakCheckRule = new ThreadLeakCheckRule();
+
+   @Rule
    public TemporaryFolder temporaryFolder;
    @Rule
    public TestName name = new TestName();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/df323bc7/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/ClusterUtil.java
----------------------------------------------------------------------
diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/ClusterUtil.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/ClusterUtil.java
deleted file mode 100644
index 42f199f..0000000
--- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/ClusterUtil.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.transport.failover;
-
-/**
- * Utilities to create broker clusters
- */
-public class ClusterUtil {
-
-}