diff options
author | Olivier Lamy <olamy@apache.org> | 2013-01-28 23:29:09 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2013-01-28 23:29:09 +0000 |
commit | 9de15a459f5d08ce13e7d3f4f5945c25d71a32cd (patch) | |
tree | 19cd59a5347700d6d5d51adfb1368919cb3aa6f6 | |
parent | 71b7c89c8ebee74d23245667081ae56e4a6cc671 (diff) | |
download | archiva-9de15a459f5d08ce13e7d3f4f5945c25d71a32cd.tar.gz archiva-9de15a459f5d08ce13e7d3f4f5945c25d71a32cd.zip |
correctly shutdown http connection manager
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1439693 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java index 8a27c031d..d15644f63 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java @@ -33,12 +33,14 @@ import org.apache.archiva.configuration.Configuration; import org.apache.archiva.configuration.UserInterfaceOptions; import org.apache.archiva.configuration.WebappConfiguration; import org.apache.commons.lang.StringUtils; +import org.apache.http.conn.ClientConnectionManager; import org.apache.http.impl.conn.PoolingClientConnectionManager; import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; import org.apache.maven.wagon.providers.http.HttpWagon; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -52,6 +54,8 @@ public class DefaultArchivaAdministration implements ArchivaAdministration { + private PoolingClientConnectionManager poolingClientConnectionManager; + @PostConstruct public void initialize() throws RepositoryAdminException @@ -61,6 +65,15 @@ public class DefaultArchivaAdministration setupWagon( networkConfiguration ); } + @PreDestroy + public void shutdown() + { + if ( this.poolingClientConnectionManager != null ) + { + this.poolingClientConnectionManager.shutdown(); + } + } + public List<LegacyArtifactPath> getLegacyArtifactPaths() throws RepositoryAdminException @@ -381,7 +394,7 @@ public class DefaultArchivaAdministration { // back to default values HttpWagon.setUseClientManagerPooled( true ); - PoolingClientConnectionManager poolingClientConnectionManager = new PoolingClientConnectionManager(); + poolingClientConnectionManager = new PoolingClientConnectionManager(); poolingClientConnectionManager.setDefaultMaxPerRoute( 30 ); poolingClientConnectionManager.setMaxTotal( 30 ); HttpWagon.setConnectionManagerPooled( poolingClientConnectionManager ); @@ -390,7 +403,7 @@ public class DefaultArchivaAdministration else { HttpWagon.setUseClientManagerPooled( networkConfiguration.isUsePooling() ); - PoolingClientConnectionManager poolingClientConnectionManager = new PoolingClientConnectionManager(); + poolingClientConnectionManager = new PoolingClientConnectionManager(); poolingClientConnectionManager.setDefaultMaxPerRoute( networkConfiguration.getMaxTotalPerHost() ); poolingClientConnectionManager.setMaxTotal( networkConfiguration.getMaxTotal() ); HttpWagon.setConnectionManagerPooled( poolingClientConnectionManager ); |