本文整理汇总了Java中com.microsoft.azure.storage.RequestResult类的典型用法代码示例。如果您正苦于以下问题:Java RequestResult类的具体用法?Java RequestResult怎么用?Java RequestResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequestResult类属于com.microsoft.azure.storage包,在下文中一共展示了RequestResult类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: responseReceived
import com.microsoft.azure.storage.RequestResult; //导入依赖的package包/类
public void responseReceived(ResponseReceivedEvent event) {
RequestResult result = event.getRequestResult();
Date startDate = result.getStartDate();
Date stopDate = result.getStopDate();
long elapsed = stopDate.getTime() - startDate.getTime();
synchronized (this) {
this.lastE2Elatency = elapsed;
}
if (LOG.isDebugEnabled()) {
int statusCode = result.getStatusCode();
String etag = result.getEtag();
HttpURLConnection urlConnection = (HttpURLConnection) event
.getConnectionObject();
int contentLength = urlConnection.getContentLength();
String requestMethod = urlConnection.getRequestMethod();
long threadId = Thread.currentThread().getId();
LOG.debug(String
.format(
"SelfThrottlingIntercept:: ResponseReceived: threadId=%d, Status=%d, Elapsed(ms)=%d, ETAG=%s, contentLength=%d, requestMethod=%s",
threadId, statusCode, elapsed, etag, contentLength, requestMethod));
}
}
示例2: eventOccurred
import com.microsoft.azure.storage.RequestResult; //导入依赖的package包/类
@Override
public void eventOccurred(ResponseReceivedEvent eventArg) {
RequestResult currentResult = operationContext.getLastResult();
int statusCode = currentResult.getStatusCode();
// Check if it's a client-side error: a 4xx status
// We exclude 404 because it happens frequently during the normal
// course of operation (each call to exists() would generate that
// if it's not found).
if (statusCode >= HTTP_BAD_REQUEST && statusCode < HTTP_INTERNAL_ERROR
&& statusCode != HTTP_NOT_FOUND) {
instrumentation.clientErrorEncountered();
} else if (statusCode >= HTTP_INTERNAL_ERROR) {
// It's a server error: a 5xx status. Could be an Azure Storage
// bug or (more likely) throttling.
instrumentation.serverErrorEncountered();
}
}
示例3: initialize
import com.microsoft.azure.storage.RequestResult; //导入依赖的package包/类
/**
* Resets the operation status flags between operations.
*/
protected final void initialize(OperationContext opContext) {
RequestResult currResult = new RequestResult();
this.setResult(currResult);
opContext.appendRequestResult(currResult);
this.setException(null);
this.setNonExceptionedRetryableFailure(false);
this.setIsSent(false);
}
示例4: fireSendingRequestEvent
import com.microsoft.azure.storage.RequestResult; //导入依赖的package包/类
/**
* Fires events representing that a request will be sent.
*/
private static void fireSendingRequestEvent(OperationContext opContext, HttpURLConnection request,
RequestResult result) {
if (opContext.getSendingRequestEventHandler().hasListeners()
|| OperationContext.getGlobalSendingRequestEventHandler().hasListeners()) {
SendingRequestEvent event = new SendingRequestEvent(opContext, request, result);
opContext.getSendingRequestEventHandler().fireEvent(event);
OperationContext.getGlobalSendingRequestEventHandler().fireEvent(event);
}
}
示例5: fireResponseReceivedEvent
import com.microsoft.azure.storage.RequestResult; //导入依赖的package包/类
/**
* Fires events representing that a response has been received.
*/
private static void fireResponseReceivedEvent(OperationContext opContext, HttpURLConnection request,
RequestResult result) {
if (opContext.getResponseReceivedEventHandler().hasListeners()
|| OperationContext.getGlobalResponseReceivedEventHandler().hasListeners()) {
ResponseReceivedEvent event = new ResponseReceivedEvent(opContext, request, result);
opContext.getResponseReceivedEventHandler().fireEvent(event);
OperationContext.getGlobalResponseReceivedEventHandler().fireEvent(event);
}
}
示例6: fireRequestCompletedEvent
import com.microsoft.azure.storage.RequestResult; //导入依赖的package包/类
/**
* Fires events representing that a response received from the service is fully processed.
*/
private static void fireRequestCompletedEvent(OperationContext opContext, HttpURLConnection request,
RequestResult result) {
if (opContext.getRequestCompletedEventHandler().hasListeners()
|| OperationContext.getGlobalRequestCompletedEventHandler().hasListeners()) {
RequestCompletedEvent event = new RequestCompletedEvent(opContext, request, result);
opContext.getRequestCompletedEventHandler().fireEvent(event);
OperationContext.getGlobalRequestCompletedEventHandler().fireEvent(event);
}
}
示例7: fireRetryingEvent
import com.microsoft.azure.storage.RequestResult; //导入依赖的package包/类
/**
* Fires events representing that a request will be retried.
*/
private static void fireRetryingEvent(OperationContext opContext, HttpURLConnection request, RequestResult result,
RetryContext retryContext) {
if (opContext.getRetryingEventHandler().hasListeners()
|| OperationContext.getGlobalRetryingEventHandler().hasListeners()) {
RetryingEvent event = new RetryingEvent(opContext, request, result, retryContext);
opContext.getRetryingEventHandler().fireEvent(event);
OperationContext.getGlobalRetryingEventHandler().fireEvent(event);
}
}
示例8: getResult
import com.microsoft.azure.storage.RequestResult; //导入依赖的package包/类
/**
* @return the result
*/
public final RequestResult getResult() {
return this.result;
}
示例9: generateTableServiceException
import com.microsoft.azure.storage.RequestResult; //导入依赖的package包/类
/**
* Reserved for internal use. A static factory method to create a {@link TableServiceException} instance using
* the specified parameters.
*
* @param retryable
* <code>true</code> if the table operation can be retried; otherwise, <code>false</code>.
* @param res
* A {@link RequestResult} containing the result of the table storage service operation.
* @param op
* The {@link TableOperation} representing the table operation that caused the exception.
* @param inStream
* The <code>java.io.InputStream</code> of the error response from the table operation request.
* @param format
* The {@link TablePayloadFormat} to use for parsing
* @return
* A {@link TableServiceException} instance initialized with values from the input parameters.
*/
protected static TableServiceException generateTableServiceException(boolean retryable, RequestResult res,
TableOperation op, InputStream inStream, TablePayloadFormat format) {
TableServiceException retryableException = new TableServiceException(res.getStatusCode(),
res.getStatusMessage(), op, new InputStreamReader(inStream), format);
retryableException.retryable = retryable;
return retryableException;
}
示例10: setResult
import com.microsoft.azure.storage.RequestResult; //导入依赖的package包/类
/**
* @param result
* the result to set
*/
public final void setResult(final RequestResult result) {
this.result = result;
}
示例11: generateTableServiceException
import com.microsoft.azure.storage.RequestResult; //导入依赖的package包/类
/**
* Reserved for internal use. A static factory method to create a {@link TableServiceException} instance using
* the specified parameters.
* @param res
* A {@link RequestResult} containing the result of the table storage service operation.
* @param op
* The {@link TableOperation} representing the table operation that caused the exception.
* @param inStream
* The <code>java.io.InputStream</code> of the error response from the table operation request.
* @param format
* The {@link TablePayloadFormat} to use for parsing
*
* @return
* A {@link TableServiceException} instance initialized with values from the input parameters.
*/
protected static TableServiceException generateTableServiceException(RequestResult res, TableOperation op,
InputStream inStream, TablePayloadFormat format) {
return new TableServiceException(res.getStatusCode(), res.getStatusMessage(), op,
new InputStreamReader(inStream), format);
}