From 33f09aca84e07ce2325f2c66cd60bb8612d31619 Mon Sep 17 00:00:00 2001 From: Naveen Singh Date: Wed, 22 Dec 2021 11:56:08 -0500 Subject: [PATCH] Mirror of https://github.com/Azure/azure-cosmosdb-java/pull/395 (#397) according to Naveen tests pass locally, issue in downloading the emulator. * mirror of https://github.com/Azure/azure-cosmosdb-java/pull/395 * need to rerun the ci again after agent upgrade from ububtu 16 to 20 * need to rerun the ci again after agent upgrade from ububtu 16 to 20 * adding space to trigger ci which is in struct state Co-authored-by: Mohammad Derakhshani --- .../directconnectivity/RntbdTransportClient.java | 2 +- .../rntbd/RntbdClientChannelPool.java | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RntbdTransportClient.java b/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RntbdTransportClient.java index 7569466c2..63fc78f35 100644 --- a/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RntbdTransportClient.java +++ b/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RntbdTransportClient.java @@ -245,7 +245,7 @@ private Options() { this.bufferPageSize = 8192; this.connectionTimeout = null; this.idleChannelTimeout = Duration.ZERO; - this.idleEndpointTimeout = Duration.ofSeconds(70L); + this.idleEndpointTimeout = Duration.ofHours(1); this.maxBufferCapacity = 8192 << 10; this.maxChannelsPerEndpoint = 10; this.maxRequestsPerChannel = 30; diff --git a/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdClientChannelPool.java b/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdClientChannelPool.java index 74ebe1343..c11cabdc1 100644 --- a/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdClientChannelPool.java +++ b/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdClientChannelPool.java @@ -605,11 +605,14 @@ public void operationComplete(Future future) { } private void fail(Throwable cause) { - if (this.acquired) { - this.pool.decrementAndRunTaskQueue(); - } else { - this.pool.runTaskQueue(); + if (!this.pool.isClosed()) { + if (this.acquired) { + this.pool.decrementAndRunTaskQueue(); + } else { + this.pool.runTaskQueue(); + } } + this.originalPromise.setFailure(cause); } }