org.frameworkset.spi.remote.http.HttpConnectionKeepAliveStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bboss-http Show documentation
Show all versions of bboss-http Show documentation
bboss http an http cluster lb component.
package org.frameworkset.spi.remote.http;
import org.apache.http.HttpResponse;
import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy;
import org.apache.http.protocol.HttpContext;
public class HttpConnectionKeepAliveStrategy extends DefaultConnectionKeepAliveStrategy{
private long keepAlive ;
public HttpConnectionKeepAliveStrategy(long keepAlive) {
this.keepAlive = keepAlive;
}
@Override
public long getKeepAliveDuration(HttpResponse response, HttpContext context) {
long keepAlive = super.getKeepAliveDuration(response, context);
if (keepAlive == -1) {
keepAlive = this.keepAlive;
}
return keepAlive;
}
}