protected void updateContext( ProxyRepository repository, RemoteStorageContext ctx ) { HttpClient httpClient = new HttpClient( new CustomMultiThreadedHttpConnectionManager() ); HttpClientProxyUtil.applyProxyToHttpClient( httpClient, ctx, getLogger() ); ctx.putContextObject( CTX_KEY_CLIENT, httpClient ); ctx.putContextObject( CTX_KEY_HTTP_CONFIGURATION, httpClient.getHostConfiguration() ); // NEXUS-3338: we don't know afer config change is remote S3 (url changed maybe) ctx.putContextObject( CTX_KEY_S3_FLAG, new BooleanFlagHolder() ); }
@Override protected void updateContext( final ProxyRepository repository, final RemoteStorageContext ctx ) throws RemoteStorageException { // reset current http client, if exists ctx.removeContextObject( CTX_KEY_CLIENT ); ctx.removeContextObject( CTX_KEY_S3_FLAG ); httpClientManager.release( repository, ctx ); try { // and create a new one final HttpClient httpClient = httpClientManager.create( repository, ctx ); ctx.putContextObject( CTX_KEY_CLIENT, httpClient ); // NEXUS-3338: we don't know after config change is remote S3 (url changed maybe) ctx.putContextObject( CTX_KEY_S3_FLAG, new BooleanFlagHolder() ); } catch ( IllegalStateException e ) { throw new RemoteStorageException( "Could not create HTTPClient4x instance!", e ); } }
@Override protected void updateContext( ProxyRepository repository, RemoteStorageContext context ) throws RemoteStorageException { if ( context.hasContextObject( CTX_KEY_CLIENT ) ) { // proper shutdown of AHC, but cannot call getClient() here that would result in endless loop! AsyncHttpClient oldClient = (AsyncHttpClient) context.getContextObject( CTX_KEY_CLIENT ); // TODO: AHC-26: current solution would kill ongoing downloads, be smarter oldClient.close(); } final AsyncHttpClientConfig.Builder clientConfigBuilder = ahcProvider.getAsyncHttpClientConfigBuilder( repository, context ); final AsyncHttpClient client = new AsyncHttpClient( clientConfigBuilder.build() ); context.putContextObject( CTX_KEY_CLIENT, client ); context.putContextObject( CTX_KEY_S3_FLAG, new BooleanFlagHolder() ); }
ctx.putContextObject( CONTEXT_UPDATED_KEY, Boolean.TRUE ); repositoryContexts.put( repository.getId(), ctx.getGeneration() );
ctx.putContextObject( NTLM_IS_IN_USE_KEY, Boolean.TRUE ); ctx.putContextObject( NTLM_IS_IN_USE_KEY, Boolean.FALSE );