当前位置: 首页>>代码示例>>Java>>正文


Java RequestResult.getStatusCode方法代码示例

本文整理汇总了Java中com.microsoft.azure.storage.RequestResult.getStatusCode方法的典型用法代码示例。如果您正苦于以下问题:Java RequestResult.getStatusCode方法的具体用法?Java RequestResult.getStatusCode怎么用?Java RequestResult.getStatusCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.microsoft.azure.storage.RequestResult的用法示例。


在下文中一共展示了RequestResult.getStatusCode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:SelfThrottlingIntercept.java

示例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();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:ErrorMetricUpdater.java

示例3: 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;
}
 
开发者ID:horizon-institute,项目名称:runspotrun-android-client,代码行数:26,代码来源:TableServiceException.java

示例4: 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);
}
 
开发者ID:Azure,项目名称:azure-storage-android,代码行数:21,代码来源:TableServiceException.java


注:本文中的com.microsoft.azure.storage.RequestResult.getStatusCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。