/** * Called after the Azure Storage SDK receives a response. Client-side * throttling uses this to collect metrics. * * @param event The connection, operation, and request state. */ public static void responseReceived(ResponseReceivedEvent event) { updateMetrics((HttpURLConnection) event.getConnectionObject(), event.getRequestResult()); }
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)); } }
@Override public void eventOccurred(ResponseReceivedEvent eventArg) { // should be appended after signing HttpURLConnection conn = (HttpURLConnection) eventArg.getConnectionObject(); assertTrue(conn.getURL().toString().indexOf(Constants.QueryConstants.API_VERSION) != -1); } });
@Override public void eventOccurred(ResponseReceivedEvent eventArg) { try { HttpURLConnection con = (HttpURLConnection) eventArg.getConnectionObject(); if ("511".equals(con.getRequestProperty(Constants.HeaderConstants.CONTENT_LENGTH))) { Thread.sleep(3000); } } catch (InterruptedException e) { // do nothing } } });
@Override public void eventOccurred(ResponseReceivedEvent eventArg) { // should be appended after signing HttpURLConnection conn = (HttpURLConnection) eventArg.getConnectionObject(); assertTrue(conn.getURL().toString().indexOf(Constants.QueryConstants.API_VERSION) != -1); } });
@Override public void eventOccurred(ResponseReceivedEvent eventArg) { HttpURLConnection conn = (HttpURLConnection) eventArg.getConnectionObject(); String urlString = conn.getURL().toString(); assertEquals(urlString.indexOf("PartitionKey"), urlString.lastIndexOf("PartitionKey")); assertEquals(urlString.indexOf("RowKey"), urlString.lastIndexOf("RowKey")); assertEquals(urlString.indexOf("Timestamp"), urlString.lastIndexOf("Timestamp")); } });
@Override public void eventOccurred(ResponseReceivedEvent eventArg) { HttpURLConnection connection = (HttpURLConnection) eventArg .getConnectionObject(); if (isGetRange(connection)) { checkObtainedMd5(connection .getHeaderField(Constants.HeaderConstants.CONTENT_MD5)); } else if (isPutBlock(connection)) { checkObtainedMd5(connection .getRequestProperty(Constants.HeaderConstants.CONTENT_MD5)); } }
@Override public void eventOccurred(ResponseReceivedEvent eventArg) { HttpURLConnection connection = (HttpURLConnection) eventArg .getConnectionObject(); if (isGetRange(connection)) { checkObtainedMd5(connection .getHeaderField(Constants.HeaderConstants.CONTENT_MD5)); } else if (isPutBlock(connection)) { checkObtainedMd5(connection .getRequestProperty(Constants.HeaderConstants.CONTENT_MD5)); } }
public void eventOccurred(ResponseReceivedEvent eventArg) { instrumentation.webResponse(); if (!(eventArg.getConnectionObject() instanceof HttpURLConnection)) { (HttpURLConnection) eventArg.getConnectionObject(); RequestResult currentResult = eventArg.getRequestResult(); if (currentResult == null) {
/** * Called after the Azure Storage SDK receives a response. * * @param event The connection, operation, and request state. */ private void responseReceived(ResponseReceivedEvent event) { HttpURLConnection conn = (HttpURLConnection) event.getConnectionObject(); BlobOperationDescriptor.OperationType operationType = BlobOperationDescriptor.getOperationType(conn); lastOperationTypeReceived = operationType; switch (operationType) { case AppendBlock: case PutBlock: case PutPage: lastContentLengthReceived = BlobOperationDescriptor.getContentLengthIfKnown(conn, operationType); break; case GetBlob: lastContentLengthReceived = BlobOperationDescriptor.getContentLengthIfKnown(conn, operationType); break; default: lastContentLengthReceived = 0; break; } }