diff --git a/zanata-war/pom.xml b/zanata-war/pom.xml
index bae5cd69b1..a38fdf1759 100644
--- a/zanata-war/pom.xml
+++ b/zanata-war/pom.xml
@@ -2016,6 +2016,18 @@
provided
+
+ se.jiderhamn
+ classloader-leak-prevention
+ 1.9.2
+
+
+ org.apache.cxf
+ cxf-rt-transports-http
+
+
+
+
diff --git a/zanata-war/src/main/java/org/zanata/servlet/LeakListener.java b/zanata-war/src/main/java/org/zanata/servlet/LeakListener.java
new file mode 100644
index 0000000000..1f5f4c0ea7
--- /dev/null
+++ b/zanata-war/src/main/java/org/zanata/servlet/LeakListener.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2014, Red Hat, Inc. and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.zanata.servlet;
+
+import java.util.logging.Level;
+
+import lombok.extern.java.Log;
+import se.jiderhamn.classloader.leak.prevention.ClassLoaderLeakPreventor;
+
+/**
+ * @author Sean Flanigan sflaniga@redhat.com
+ *
+ */
+@Log
+public class LeakListener extends ClassLoaderLeakPreventor {
+ protected void debug(String s) {
+ log.fine(s);
+ }
+
+ protected void info(String s) {
+ log.info(s);
+ }
+
+ protected void warn(String s) {
+ log.warning(s);
+ }
+
+ protected void warn(Throwable t) {
+ log.log(Level.WARNING, "", t);
+ }
+
+ protected void error(String s) {
+ log.severe(s);
+ }
+
+ protected void error(Throwable t) {
+ log.log(Level.SEVERE, "", t);
+ }
+
+}
diff --git a/zanata-war/src/main/java/org/zanata/webtrans/server/TranslationWorkspaceManagerImpl.java b/zanata-war/src/main/java/org/zanata/webtrans/server/TranslationWorkspaceManagerImpl.java
index 00fefeaa82..46966746ec 100644
--- a/zanata-war/src/main/java/org/zanata/webtrans/server/TranslationWorkspaceManagerImpl.java
+++ b/zanata-war/src/main/java/org/zanata/webtrans/server/TranslationWorkspaceManagerImpl.java
@@ -56,6 +56,8 @@
import de.novanic.eventservice.service.registry.EventRegistry;
import de.novanic.eventservice.service.registry.EventRegistryFactory;
+import de.novanic.eventservice.service.registry.user.UserManager;
+import de.novanic.eventservice.service.registry.user.UserManagerFactory;
@Scope(ScopeType.APPLICATION)
@Name("translationWorkspaceManager")
@@ -103,13 +105,6 @@ ValidationService getValidationService() {
@Observer(ZanataInit.EVENT_Zanata_Startup)
public void start() {
log.info("starting...");
-
- Runtime.getRuntime().addShutdownHook(new Thread() {
- @Override
- public void run() {
- stopListeners();
- }
- });
}
@Observer(ZanataIdentity.USER_LOGOUT_EVENT)
@@ -216,9 +211,7 @@ private boolean projectIterationIsActive(EntityStatus projectStatus,
public void stop() {
log.info("stopping...");
log.info("closing down {} workspaces: ", workspaceMap.size());
- }
- private void stopListeners() {
// Stopping the listeners frees up the EventServiceImpl servlet, which
// would otherwise prevent Apache Coyote from shutting down quickly.
// Note that the servlet may still hang around up to the max timeout
@@ -233,6 +226,9 @@ private void stopListeners() {
log.info(
"Removed {} client(s). Waiting for outstanding polls to time out...",
clientCount);
+ UserManager userManager =
+ UserManagerFactory.getInstance().getUserManager();
+ userManager.getUserActivityScheduler().stop();
}
@Override
diff --git a/zanata-war/src/main/webapp-jboss/WEB-INF/web.xml b/zanata-war/src/main/webapp-jboss/WEB-INF/web.xml
index 8a5385fe19..2219c616cb 100644
--- a/zanata-war/src/main/webapp-jboss/WEB-INF/web.xml
+++ b/zanata-war/src/main/webapp-jboss/WEB-INF/web.xml
@@ -73,7 +73,8 @@
@@ -110,6 +111,11 @@
java:jboss/datasources/${ds.jndi.name}
+
+
+ org.zanata.servlet.LeakListener
+
+
liquibase.integration.servlet.LiquibaseServletListener