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;
implements ArchivaAdministration
{
+ private PoolingClientConnectionManager poolingClientConnectionManager;
+
@PostConstruct
public void initialize()
throws RepositoryAdminException
setupWagon( networkConfiguration );
}
+ @PreDestroy
+ public void shutdown()
+ {
+ if ( this.poolingClientConnectionManager != null )
+ {
+ this.poolingClientConnectionManager.shutdown();
+ }
+ }
+
public List<LegacyArtifactPath> getLegacyArtifactPaths()
throws RepositoryAdminException
{
// back to default values
HttpWagon.setUseClientManagerPooled( true );
- PoolingClientConnectionManager poolingClientConnectionManager = new PoolingClientConnectionManager();
+ poolingClientConnectionManager = new PoolingClientConnectionManager();
poolingClientConnectionManager.setDefaultMaxPerRoute( 30 );
poolingClientConnectionManager.setMaxTotal( 30 );
HttpWagon.setConnectionManagerPooled( poolingClientConnectionManager );
else
{
HttpWagon.setUseClientManagerPooled( networkConfiguration.isUsePooling() );
- PoolingClientConnectionManager poolingClientConnectionManager = new PoolingClientConnectionManager();
+ poolingClientConnectionManager = new PoolingClientConnectionManager();
poolingClientConnectionManager.setDefaultMaxPerRoute( networkConfiguration.getMaxTotalPerHost() );
poolingClientConnectionManager.setMaxTotal( networkConfiguration.getMaxTotal() );
HttpWagon.setConnectionManagerPooled( poolingClientConnectionManager );