public abstract class AbfsHttpOperation extends Object implements AbfsPerfLoggable
For JDK netlib usage, the child class would be AbfsJdkHttpOperation.
For ApacheHttpClient netlib usage, the child class would be AbfsAHCHttpOperation.
| Modifier and Type | Class and Description |
|---|---|
static class |
AbfsHttpOperation.AbfsHttpOperationWithFixedResult |
| Modifier | Constructor and Description |
|---|---|
|
AbfsHttpOperation(org.slf4j.Logger log,
URL url,
String method,
List<AbfsHttpHeader> requestHeaders,
Duration connectionTimeout,
Duration readTimeout) |
protected |
AbfsHttpOperation(URL url,
String method,
int httpStatus)
Constructor for FixedResult instance, avoiding connection init.
|
| Modifier and Type | Method and Description |
|---|---|
static AbfsHttpOperation |
getAbfsHttpOperationWithFixedResult(URL url,
String method,
int httpStatus) |
long |
getBytesReceived() |
int |
getBytesSent() |
String |
getClientRequestId() |
protected abstract InputStream |
getContentInputStream()
Get the response stream from the connection.
|
protected abstract InputStream |
getErrorStream()
Get the error stream from the connection.
|
String |
getExpectedAppendPos() |
int |
getExpectedBytesToBeSent() |
String |
getHost() |
ListResultSchema |
getListResultSchema() |
String |
getLogString()
Gets the string to log to the Abfs Logging API.
|
String |
getMaskedEncodedUrl() |
String |
getMaskedUrl() |
String |
getMethod() |
long |
getRecvLatency() |
String |
getRequestId() |
abstract String |
getResponseHeader(String httpHeader)
Get response header value for the given headerKey.
|
long |
getSendLatency() |
int |
getStatusCode() |
String |
getStatusDescription() |
String |
getStorageErrorCode() |
String |
getStorageErrorMessage() |
abstract String |
getTracingContextSuffix()
Get the suffix to add to the tracing context that defines what http-client is
used to make the network call
|
URL |
getUrl() |
protected boolean |
isConnectionDisconnectedOnError() |
abstract void |
processResponse(byte[] buffer,
int offset,
int length)
Gets and processes the HTTP response.
|
abstract void |
sendPayload(byte[] buffer,
int offset,
int length)
Sends the HTTP request.
|
protected void |
setBytesSent(int bytesSent)
Sets byteSent metric.
|
protected void |
setConnectionDisconnectedOnError()
Marks network error and expect100 failures for send-payload phase.
|
protected void |
setConnectionTimeMs(long connectionTimeMs)
Sets connection time in milliseconds taken to establish the connection.
|
protected void |
setExpectedBytesToBeSent(int expectedBytesToBeSent)
Sets expected bytes to be sent.
|
void |
setMaskForSAS() |
protected void |
setRecvResponseTimeMs(long recvResponseTimeMs)
Sets receive response time in milliseconds.
|
protected void |
setRequestId()
Set x-ms-request-id value from the server call response header.
|
abstract void |
setRequestProperty(String key,
String value)
Set request header.
|
protected void |
setSendRequestTimeMs(long sendRequestTimeMs)
Sets send request time in milliseconds.
|
protected void |
setStatusCode(int statusCode)
Set response status code for the server call.
|
protected void |
setStatusDescription(String statusDescription)
Sets response status description for the server call.
|
String |
toString() |
public AbfsHttpOperation(org.slf4j.Logger log,
URL url,
String method,
List<AbfsHttpHeader> requestHeaders,
Duration connectionTimeout,
Duration readTimeout)
public static AbfsHttpOperation getAbfsHttpOperationWithFixedResult(URL url, String method, int httpStatus)
public String getMethod()
public String getHost()
public int getStatusCode()
public String getStatusDescription()
public String getStorageErrorCode()
public String getStorageErrorMessage()
public String getClientRequestId()
public String getExpectedAppendPos()
public String getRequestId()
public void setMaskForSAS()
public int getBytesSent()
public int getExpectedBytesToBeSent()
public long getBytesReceived()
public URL getUrl()
public ListResultSchema getListResultSchema()
public abstract String getResponseHeader(String httpHeader)
httpHeader - header key.public String getLogString()
AbfsPerfLoggablegetLogString in interface AbfsPerfLoggable@VisibleForTesting public String getMaskedUrl()
public final String getMaskedEncodedUrl()
public abstract void sendPayload(byte[] buffer,
int offset,
int length)
throws IOException
buffer - the request entity body.offset - an offset into the buffer where the data beings.length - the length of the data in the buffer.IOException - if an error occurs.public abstract void processResponse(byte[] buffer,
int offset,
int length)
throws IOException
buffer - a buffer to hold the response entity bodyoffset - an offset in the buffer where the data will being.length - the number of bytes to be written to the buffer.IOException - if an error occurs.public abstract void setRequestProperty(String key, String value)
key - header key.value - header value.protected abstract InputStream getContentInputStream() throws IOException
IOException - if the response stream could not be created from the connection.protected abstract InputStream getErrorStream() throws IOException
IOException - if the error stream could not be created from the response stream.public abstract String getTracingContextSuffix()
public final long getSendLatency()
public final long getRecvLatency()
protected void setStatusCode(int statusCode)
statusCode - status code.protected void setStatusDescription(String statusDescription)
statusDescription - status description.protected void setRequestId()
protected void setBytesSent(int bytesSent)
bytesSent - bytes sent.protected void setExpectedBytesToBeSent(int expectedBytesToBeSent)
expectedBytesToBeSent - expected bytes to be sent.protected void setConnectionTimeMs(long connectionTimeMs)
connectionTimeMs - connection time in milliseconds.protected void setSendRequestTimeMs(long sendRequestTimeMs)
sendRequestTimeMs - send request time in milliseconds.protected void setRecvResponseTimeMs(long recvResponseTimeMs)
recvResponseTimeMs - receive response time in milliseconds.protected void setConnectionDisconnectedOnError()
protected boolean isConnectionDisconnectedOnError()
connectionDisconnectedOnErrorCopyright © 2008–2024 Apache Software Foundation. All rights reserved.