mirror of https://github.com/apache/archiva.git
correctly shutdown http connection manager
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1439693 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
71b7c89c8e
commit
9de15a459f
|
@ -33,12 +33,14 @@ import org.apache.archiva.configuration.Configuration;
|
||||||
import org.apache.archiva.configuration.UserInterfaceOptions;
|
import org.apache.archiva.configuration.UserInterfaceOptions;
|
||||||
import org.apache.archiva.configuration.WebappConfiguration;
|
import org.apache.archiva.configuration.WebappConfiguration;
|
||||||
import org.apache.commons.lang.StringUtils;
|
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.PoolingClientConnectionManager;
|
||||||
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
|
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
|
||||||
import org.apache.maven.wagon.providers.http.HttpWagon;
|
import org.apache.maven.wagon.providers.http.HttpWagon;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.annotation.PreDestroy;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -52,6 +54,8 @@ public class DefaultArchivaAdministration
|
||||||
implements ArchivaAdministration
|
implements ArchivaAdministration
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private PoolingClientConnectionManager poolingClientConnectionManager;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void initialize()
|
public void initialize()
|
||||||
throws RepositoryAdminException
|
throws RepositoryAdminException
|
||||||
|
@ -61,6 +65,15 @@ public class DefaultArchivaAdministration
|
||||||
setupWagon( networkConfiguration );
|
setupWagon( networkConfiguration );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PreDestroy
|
||||||
|
public void shutdown()
|
||||||
|
{
|
||||||
|
if ( this.poolingClientConnectionManager != null )
|
||||||
|
{
|
||||||
|
this.poolingClientConnectionManager.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<LegacyArtifactPath> getLegacyArtifactPaths()
|
public List<LegacyArtifactPath> getLegacyArtifactPaths()
|
||||||
throws RepositoryAdminException
|
throws RepositoryAdminException
|
||||||
|
@ -381,7 +394,7 @@ public class DefaultArchivaAdministration
|
||||||
{
|
{
|
||||||
// back to default values
|
// back to default values
|
||||||
HttpWagon.setUseClientManagerPooled( true );
|
HttpWagon.setUseClientManagerPooled( true );
|
||||||
PoolingClientConnectionManager poolingClientConnectionManager = new PoolingClientConnectionManager();
|
poolingClientConnectionManager = new PoolingClientConnectionManager();
|
||||||
poolingClientConnectionManager.setDefaultMaxPerRoute( 30 );
|
poolingClientConnectionManager.setDefaultMaxPerRoute( 30 );
|
||||||
poolingClientConnectionManager.setMaxTotal( 30 );
|
poolingClientConnectionManager.setMaxTotal( 30 );
|
||||||
HttpWagon.setConnectionManagerPooled( poolingClientConnectionManager );
|
HttpWagon.setConnectionManagerPooled( poolingClientConnectionManager );
|
||||||
|
@ -390,7 +403,7 @@ public class DefaultArchivaAdministration
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HttpWagon.setUseClientManagerPooled( networkConfiguration.isUsePooling() );
|
HttpWagon.setUseClientManagerPooled( networkConfiguration.isUsePooling() );
|
||||||
PoolingClientConnectionManager poolingClientConnectionManager = new PoolingClientConnectionManager();
|
poolingClientConnectionManager = new PoolingClientConnectionManager();
|
||||||
poolingClientConnectionManager.setDefaultMaxPerRoute( networkConfiguration.getMaxTotalPerHost() );
|
poolingClientConnectionManager.setDefaultMaxPerRoute( networkConfiguration.getMaxTotalPerHost() );
|
||||||
poolingClientConnectionManager.setMaxTotal( networkConfiguration.getMaxTotal() );
|
poolingClientConnectionManager.setMaxTotal( networkConfiguration.getMaxTotal() );
|
||||||
HttpWagon.setConnectionManagerPooled( poolingClientConnectionManager );
|
HttpWagon.setConnectionManagerPooled( poolingClientConnectionManager );
|
||||||
|
|
Loading…
Reference in New Issue