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.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 );
|
||||
|
|
Loading…
Reference in New Issue