@Contract(threading=STATELESS) public class DefaultConnectionKeepAliveStrategy extends Object implements ConnectionKeepAliveStrategy
The default implementation looks solely at the 'Keep-Alive' header's timeout token.
Modifier and Type | Field and Description |
---|---|
static DefaultConnectionKeepAliveStrategy |
INSTANCE
Default instance of
DefaultConnectionKeepAliveStrategy . |
Constructor and Description |
---|
DefaultConnectionKeepAliveStrategy() |
Modifier and Type | Method and Description |
---|---|
org.apache.hc.core5.util.TimeValue |
getKeepAliveDuration(org.apache.hc.core5.http.HttpResponse response,
org.apache.hc.core5.http.protocol.HttpContext context)
Returns the duration of time which this connection can be safely kept
idle.
|
public static final DefaultConnectionKeepAliveStrategy INSTANCE
DefaultConnectionKeepAliveStrategy
.public org.apache.hc.core5.util.TimeValue getKeepAliveDuration(org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.http.protocol.HttpContext context)
ConnectionKeepAliveStrategy
ConnectionReuseStrategy
, if
ConnectionReuseStrategy.keepAlive(
org.apache.hc.core5.http.HttpRequest, HttpResponse, HttpContext)
returns true,
this allows you to control how long the reuse will last. If keepAlive returns
false, this should have no meaningful impactgetKeepAliveDuration
in interface ConnectionKeepAliveStrategy
response
- The last response received over the connection.context
- the context in which the connection is being used.Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.