This commit is contained in:
David Noble 2019-05-23 14:42:00 -07:00
Родитель f73bce16e9
Коммит 77ee0481e3
2 изменённых файлов: 9 добавлений и 8 удалений

Просмотреть файл

@ -55,6 +55,7 @@ import java.util.concurrent.atomic.AtomicLong;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdReporter.reportIssueUnless;
@JsonSerialize(using = RntbdTransportClient.JsonSerializer.class)
public final class RntbdTransportClient extends TransportClient implements AutoCloseable {
@ -136,11 +137,9 @@ public final class RntbdTransportClient extends TransportClient implements AutoC
if (error == null) {
emitter.onSuccess(response);
} else {
if (!(error instanceof DocumentClientException)) {
logger.warn("{} expected error of {}, not ", requestArgs, DocumentClientException.class, error);
}
reportIssueUnless(error instanceof DocumentClientException, logger, requestRecord, "", error);
this.metrics.incrementErrorResponseCount();
emitter.onError(error instanceof CompletionException ? error.getCause() : error);
emitter.onError(error);
}
requestArgs.traceOperation(logger, null, "emitSingleComplete");

Просмотреть файл

@ -71,11 +71,13 @@ public final class RntbdRequestRecord extends CompletableFuture<StoreResponse> {
}
public boolean expire() {
final RequestTimeoutException error = new RequestTimeoutException(
String.format("Request timeout interval (%,d ms) elapsed",
this.timer.getRequestTimeout(TimeUnit.MILLISECONDS)),
this.args.getPhysicalAddress());
final long timeoutInterval = this.timer.getRequestTimeout(TimeUnit.MILLISECONDS);
final String message = String.format("Request timeout interval (%,d ms) elapsed", timeoutInterval);
final RequestTimeoutException error = new RequestTimeoutException(message, this.args.getPhysicalAddress());
BridgeInternal.setRequestHeaders(error, this.args.getServiceRequest().getHeaders());
return this.completeExceptionally(error);
}