@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); } });
/** * 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()); }
@Override public void eventOccurred(ResponseReceivedEvent eventArg) { assertEquals(eventArg.getRequestResult(), eventArg.getOpContext().getLastResult()); globalCallList.add(true); } });
@Override public void eventOccurred(ResponseReceivedEvent eventArg) { // Set status code to 500 to force a retry eventArg.getRequestResult().setStatusCode(500); } });
/** * 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); } }
@Override public void eventOccurred(ResponseReceivedEvent eventArg) { // Set status code to 500 to force a retry eventArg.getRequestResult().setStatusCode(500); } });
/** * 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); } }
@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 } } });
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) { assertEquals(eventArg.getRequestResult(), eventArg.getOpContext().getLastResult()); callList.add(true); } });
@Override public void eventOccurred(ResponseReceivedEvent eventArg) { // This is the first try at appending. This error code will cause it to retry. // On the retry we set the error to append pos which should be ignored as the // absorb conditional errors on retry flag is set to true. if (count == 1) { eventArg.getRequestResult().setStatusCode(HttpURLConnection.HTTP_INTERNAL_ERROR); } else if (count == 2) { eventArg.getRequestResult().setStatusCode(HttpURLConnection.HTTP_PRECON_FAILED); eventArg.getRequestResult().setStatusMessage(StorageErrorCodeStrings.INVALID_APPEND_POSITION); } count++; } });
@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); } });
public void eventOccurred(ResponseReceivedEvent eventArg) { instrumentation.webResponse(); if (!(eventArg.getConnectionObject() instanceof HttpURLConnection)) { (HttpURLConnection) eventArg.getConnectionObject(); RequestResult currentResult = eventArg.getRequestResult(); if (currentResult == null) {
@Override public void eventOccurred(ResponseReceivedEvent eventArg) { // This is the first try at appending. This error code will cause it to retry. // On the retry we set the error to max size which should be ignored as the // absorb conditional errors on retry flag is set to true. if (count == 1) { eventArg.getRequestResult().setStatusCode(HttpURLConnection.HTTP_INTERNAL_ERROR); } else if (count == 2) { eventArg.getRequestResult().setStatusCode(HttpURLConnection.HTTP_PRECON_FAILED); eventArg.getRequestResult().setStatusMessage(StorageErrorCodeStrings.INVALID_MAX_BLOB_SIZE_CONDITION); } count++; } });
@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)); } }
/** * 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; } }