public static int requestTimeout(AsyncHttpClientConfig config, Request request) { return request.getRequestTimeout() != 0 ? request.getRequestTimeout() : config.getRequestTimeout(); }
void touchConnection(final Connection c, final Request request) { final long timeOut = request.getRequestTimeout() > 0 ? request.getRequestTimeout() : clientConfig.getRequestTimeout(); if (timeOut > 0) { if (resolver != null) { resolver.setTimeoutMillis(c, System.currentTimeMillis() + timeOut); } } }
@Override public long getTimeout(final FilterChainContext ctx) { final Connection connection = ctx.getConnection(); if (connectionManager.isReadyInPool(connection)) { // if the connection is in pool - let ConnectionManager take care of its life cycle return IdleTimeoutFilter.FOREVER; } final HttpTransactionContext context = HttpTransactionContext.currentTransaction(connection); if (context != null) { if (context.isWSRequest) { return clientConfig.getWebSocketTimeout(); } final long timeout = context.getAhcRequest().getRequestTimeout(); if (timeout > 0) { return timeout; } } return timeout; } };
@Override public int getRequestTimeout() { return delegate.getRequestTimeout(); }
public static int requestTimeout(AsyncHttpClientConfig config, Request request) { return request.getRequestTimeout() != 0 ? request.getRequestTimeout() : config.getRequestTimeout(); }
public static int requestTimeout(AsyncHttpClientConfig config, Request request) { return request.getRequestTimeout() != 0 ? request.getRequestTimeout() : config.getRequestTimeout(); }
public RequestImpl(Request prototype) { if (prototype != null) { this.method = prototype.getMethod(); this.uri = prototype.getUri(); this.address = prototype.getInetAddress(); this.localAddress = prototype.getLocalAddress(); this.headers = new FluentCaseInsensitiveStringsMap(prototype.getHeaders()); this.cookies = new ArrayList<>(prototype.getCookies()); this.byteData = prototype.getByteData(); this.compositeByteData = prototype.getCompositeByteData(); this.stringData = prototype.getStringData(); this.streamData = prototype.getStreamData(); this.bodyGenerator = prototype.getBodyGenerator(); this.formParams = prototype.getFormParams() == null ? null : new ArrayList<>(prototype.getFormParams()); this.parts = prototype.getParts() == null ? null : new ArrayList<>(prototype.getParts()); this.virtualHost = prototype.getVirtualHost(); this.length = prototype.getContentLength(); this.proxyServer = prototype.getProxyServer(); this.realm = prototype.getRealm(); this.file = prototype.getFile(); this.followRedirects = prototype.getFollowRedirect(); this.requestTimeout = prototype.getRequestTimeout(); this.rangeOffset = prototype.getRangeOffset(); this.charset = prototype.getBodyEncoding(); this.connectionPoolPartitioning = prototype.getConnectionPoolPartitioning(); this.nameResolver = prototype.getNameResolver(); } }
public static int requestTimeout(AsyncHttpClientConfig config, Request request) { return request.getRequestTimeout() != 0 ? request.getRequestTimeout() : config.getRequestTimeout(); }
void touchConnection(final Connection c, final Request request) { final long timeOut = request.getRequestTimeout() > 0 ? request.getRequestTimeout() : clientConfig.getRequestTimeout(); if (timeOut > 0) { if (resolver != null) { resolver.setTimeoutMillis(c, System.currentTimeMillis() + timeOut); } } }
void touchConnection(final Connection c, final Request request) { final long timeOut = request.getRequestTimeout() > 0 ? request.getRequestTimeout() : clientConfig.getRequestTimeout(); if (timeOut > 0) { if (resolver != null) { resolver.setTimeoutMillis(c, System.currentTimeMillis() + timeOut); } } }
void touchConnection(final Connection c, final Request request) { final long perRequestTimeout = request.getRequestTimeout(); if (perRequestTimeout > 0) { final long newTimeout = System.currentTimeMillis() + perRequestTimeout; if (resolver != null) { resolver.setTimeoutMillis(c, newTimeout); } } else { final long timeout = clientConfig.getRequestTimeout(); if (timeout > 0) { if (resolver != null) { resolver.setTimeoutMillis(c, System.currentTimeMillis() + timeout); } } } }
.setRequestTimeout(request.getRequestTimeout())// .setVirtualHost(request.getVirtualHost()); if (keepBody) {
@Override public long getTimeout(FilterChainContext ctx) { final HttpTransactionContext context = HttpTransactionContext.get(ctx.getConnection()); if (context != null) { if (context.isWSRequest) { return clientConfig.getWebSocketTimeout(); } final long timeout = context.request.getRequestTimeout(); if (timeout > 0) { return timeout; } } return timeout; } };
@Override public FilterContext filter(FilterContext ctx) throws FilterException { try { if (logger.isDebugEnabled()) { logger.debug("Current Throttling Status {}", available.availablePermits()); } if (!available.tryAcquire(ctx.getRequest().getRequestTimeout(), MILLISECONDS)) { throw new FilterException(String.format("No slot available for processing Request %s with AsyncHandler %s", ctx.getRequest(), ctx.getAsyncHandler())); } } catch (InterruptedException e) { throw new FilterException(String.format("Interrupted Request %s with AsyncHandler %s", ctx.getRequest(), ctx.getAsyncHandler())); } return new FilterContext.FilterContextBuilder(ctx).asyncHandler(new AsyncHandlerWrapper(ctx.getAsyncHandler())).build(); }
@Override public FilterContext filter(FilterContext ctx) throws FilterException { try { if (logger.isDebugEnabled()) { logger.debug("Current Throttling Status {}", available.availablePermits()); } if (!available.tryAcquire(ctx.getRequest().getRequestTimeout(), MILLISECONDS)) { throw new FilterException( String.format("No slot available for processing Request %s with AsyncHandler %s", ctx.getRequest(), ctx.getAsyncHandler())); } } catch (InterruptedException e) { throw new FilterException( String.format("Interrupted Request %s with AsyncHandler %s", ctx.getRequest(), ctx.getAsyncHandler())); } return new FilterContext.FilterContextBuilder(ctx).asyncHandler(new AsyncHandlerWrapper(ctx.getAsyncHandler())).build(); }
@Override public long getTimeout(final FilterChainContext ctx) { final Connection connection = ctx.getConnection(); if (connectionManager.isReadyInPool(connection)) { // if the connection is in pool - let ConnectionManager take care of its life cycle return IdleTimeoutFilter.FOREVER; } final HttpTransactionContext context = HttpTransactionContext.currentTransaction(connection); if (context != null) { if (context.isWSRequest) { return clientConfig.getWebSocketTimeout(); } final long timeout = context.getAhcRequest().getRequestTimeout(); if (timeout > 0) { return timeout; } } return timeout; } };
@Override public long getTimeout(final FilterChainContext ctx) { final Connection connection = ctx.getConnection(); if (connectionManager.isReadyInPool(connection)) { // if the connection is in pool - let ConnectionManager take care of its life cycle return IdleTimeoutFilter.FOREVER; } final HttpTransactionContext context = HttpTransactionContext.currentTransaction(connection); if (context != null) { if (context.isWSRequest) { return clientConfig.getWebSocketTimeout(); } final long timeout = context.getAhcRequest().getRequestTimeout(); if (timeout > 0) { return timeout; } } return timeout; } };
public RequestImpl(Request prototype) { if (prototype != null) { this.method = prototype.getMethod(); this.uri = prototype.getURI(); this.address = prototype.getInetAddress(); this.localAddress = prototype.getLocalAddress(); this.headers = new FluentCaseInsensitiveStringsMap(prototype.getHeaders()); this.cookies = new ArrayList<Cookie>(prototype.getCookies()); this.byteData = prototype.getByteData(); this.stringData = prototype.getStringData(); this.streamData = prototype.getStreamData(); this.bodyGenerator = prototype.getBodyGenerator(); this.formParams = prototype.getFormParams() == null ? null : new ArrayList<Param>(prototype.getFormParams()); this.parts = prototype.getParts() == null ? null : new ArrayList<Part>(prototype.getParts()); this.virtualHost = prototype.getVirtualHost(); this.length = prototype.getContentLength(); this.proxyServer = prototype.getProxyServer(); this.realm = prototype.getRealm(); this.file = prototype.getFile(); this.followRedirects = prototype.getFollowRedirect(); this.requestTimeout = prototype.getRequestTimeout(); this.rangeOffset = prototype.getRangeOffset(); this.charset = prototype.getBodyEncoding(); this.connectionPoolKeyStrategy = prototype.getConnectionPoolKeyStrategy(); } }
public RequestImpl(Request prototype) { if (prototype != null) { this.method = prototype.getMethod(); this.uri = prototype.getUri(); this.address = prototype.getInetAddress(); this.localAddress = prototype.getLocalAddress(); this.headers = new FluentCaseInsensitiveStringsMap(prototype.getHeaders()); this.cookies = new ArrayList<>(prototype.getCookies()); this.byteData = prototype.getByteData(); this.compositeByteData = prototype.getCompositeByteData(); this.stringData = prototype.getStringData(); this.streamData = prototype.getStreamData(); this.bodyGenerator = prototype.getBodyGenerator(); this.formParams = prototype.getFormParams() == null ? null : new ArrayList<>(prototype.getFormParams()); this.parts = prototype.getParts() == null ? null : new ArrayList<>(prototype.getParts()); this.virtualHost = prototype.getVirtualHost(); this.length = prototype.getContentLength(); this.proxyServer = prototype.getProxyServer(); this.realm = prototype.getRealm(); this.file = prototype.getFile(); this.followRedirects = prototype.getFollowRedirect(); this.requestTimeout = prototype.getRequestTimeout(); this.rangeOffset = prototype.getRangeOffset(); this.charset = prototype.getBodyEncoding(); this.connectionPoolPartitioning = prototype.getConnectionPoolPartitioning(); this.nameResolver = prototype.getNameResolver(); } }
public RequestImpl(Request prototype) { if (prototype != null) { this.method = prototype.getMethod(); this.uri = prototype.getUri(); this.address = prototype.getInetAddress(); this.localAddress = prototype.getLocalAddress(); this.headers = new FluentCaseInsensitiveStringsMap(prototype.getHeaders()); this.cookies = new ArrayList<>(prototype.getCookies()); this.byteData = prototype.getByteData(); this.compositeByteData = prototype.getCompositeByteData(); this.stringData = prototype.getStringData(); this.streamData = prototype.getStreamData(); this.bodyGenerator = prototype.getBodyGenerator(); this.formParams = prototype.getFormParams() == null ? null : new ArrayList<>(prototype.getFormParams()); this.parts = prototype.getParts() == null ? null : new ArrayList<>(prototype.getParts()); this.virtualHost = prototype.getVirtualHost(); this.length = prototype.getContentLength(); this.proxyServer = prototype.getProxyServer(); this.realm = prototype.getRealm(); this.file = prototype.getFile(); this.followRedirects = prototype.getFollowRedirect(); this.requestTimeout = prototype.getRequestTimeout(); this.rangeOffset = prototype.getRangeOffset(); this.charset = prototype.getBodyEncoding(); this.connectionPoolPartitioning = prototype.getConnectionPoolPartitioning(); this.nameResolver = prototype.getNameResolver(); } }