You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/11/14 10:31:14 UTC
[camel] branch camel-2.20.x updated: CAMEL-12007:
MavenVersionManager is now Closable so we can clean up any http connections
and not leak resources/threads
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-2.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-2.20.x by this push:
new 22fc0e9 CAMEL-12007: MavenVersionManager is now Closable so we can clean up any http connections and not leak resources/threads
22fc0e9 is described below
commit 22fc0e94ecc179e712c48cb8332bd7e5b5a26926
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Nov 14 11:30:23 2017 +0100
CAMEL-12007: MavenVersionManager is now Closable so we can clean up any http connections and not leak resources/threads
---
.../org/apache/camel/catalog/maven/MavenVersionManager.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/MavenVersionManager.java b/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/MavenVersionManager.java
index ed27a4f..2ae4080 100644
--- a/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/MavenVersionManager.java
+++ b/platforms/camel-catalog-maven/src/main/java/org/apache/camel/catalog/maven/MavenVersionManager.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.catalog.maven;
+import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -26,6 +27,7 @@ import java.util.Map;
import groovy.grape.Grape;
import groovy.lang.GroovyClassLoader;
import org.apache.camel.catalog.VersionManager;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.ivy.util.url.URLHandlerRegistry;
/**
@@ -34,7 +36,7 @@ import org.apache.ivy.util.url.URLHandlerRegistry;
* <p/>
* This implementation uses Groovy Grape to download the Maven JARs.
*/
-public class MavenVersionManager implements VersionManager {
+public class MavenVersionManager implements VersionManager, Closeable {
private final ClassLoader classLoader = new GroovyClassLoader();
private final TimeoutHttpClientHandler httpClient = new TimeoutHttpClientHandler();
@@ -191,4 +193,11 @@ public class MavenVersionManager implements VersionManager {
return null;
}
+
+ @Override
+ public void close() throws IOException {
+ // the http client uses this MultiThreadedHttpConnectionManager for handling http connections
+ // and we should ensure its shutdown to not leak connections/threads
+ MultiThreadedHttpConnectionManager.shutdownAll();
+ }
}
--
To stop receiving notification emails like this one, please contact
['"commits@camel.apache.org" <co...@camel.apache.org>'].