com.sap.hana.datalake.files.utils.http.DefaultTimeConnectionKeepAliveStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sap-hdlfs Show documentation
Show all versions of sap-hdlfs Show documentation
An implementation of org.apache.hadoop.fs.FileSystem targeting SAP HANA Data Lake Files.
// © 2023-2024 SAP SE or an SAP affiliate company. All rights reserved.
package com.sap.hana.datalake.files.utils.http;
import com.sap.hana.datalake.files.classification.InterfaceAudience;
import org.apache.http.HttpResponse;
import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy;
import org.apache.http.protocol.HttpContext;
@InterfaceAudience.Private
public class DefaultTimeConnectionKeepAliveStrategy extends DefaultConnectionKeepAliveStrategy {
private final long defaultKeepAliveTimeMs;
public DefaultTimeConnectionKeepAliveStrategy(final long defaultKeepAliveTimeSecs) {
this.defaultKeepAliveTimeMs = defaultKeepAliveTimeSecs * 1_000L;
}
@Override
public long getKeepAliveDuration(final HttpResponse response, final HttpContext context) {
final long keepAliveFromServer = super.getKeepAliveDuration(response, context);
return keepAliveFromServer > 0 ? keepAliveFromServer : this.defaultKeepAliveTimeMs;
}
}
// © 2023-2024 SAP SE or an SAP affiliate company. All rights reserved.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy