diff --git a/gxcosmosdb/src/main/java/com/genexus/db/cosmosdb/CosmosDBConnection.java b/gxcosmosdb/src/main/java/com/genexus/db/cosmosdb/CosmosDBConnection.java index e4d50529a..52cfecfa6 100644 --- a/gxcosmosdb/src/main/java/com/genexus/db/cosmosdb/CosmosDBConnection.java +++ b/gxcosmosdb/src/main/java/com/genexus/db/cosmosdb/CosmosDBConnection.java @@ -74,8 +74,9 @@ private void initializeDBConnection(String connUrl) throws Exception .endpoint(maccountEndpoint) .key(maccountKey) .consistencyLevel(ConsistencyLevel.EVENTUAL) - .contentResponseOnWriteEnabled(true) + //.contentResponseOnWriteEnabled(true) Disabled for performance .preferredRegions(Collections.singletonList(mregion)) + .connectionSharingAcrossClientsEnabled(true) .buildAsyncClient(); cosmosDatabase = cosmosClient.getDatabase(mdatabase); diff --git a/gxcosmosdb/src/main/java/com/genexus/db/cosmosdb/CosmosDBPreparedStatement.java b/gxcosmosdb/src/main/java/com/genexus/db/cosmosdb/CosmosDBPreparedStatement.java index 63ec4f314..4702b2d7b 100644 --- a/gxcosmosdb/src/main/java/com/genexus/db/cosmosdb/CosmosDBPreparedStatement.java +++ b/gxcosmosdb/src/main/java/com/genexus/db/cosmosdb/CosmosDBPreparedStatement.java @@ -17,6 +17,7 @@ import com.genexus.util.NameValuePair; import json.org.json.JSONException; import json.org.json.JSONObject; +import reactor.core.Disposable; import reactor.core.publisher.Mono; import java.io.InputStream; @@ -45,7 +46,7 @@ public class CosmosDBPreparedStatement extends ServicePreparedStatement super(con, parms, gxCon); this.query = query; this.cursor = cursor; - getCointainer(query.tableName); + getContainer(query.tableName); } @Override public ResultSet executeQuery() throws SQLException @@ -135,7 +136,7 @@ private int _executeQuery(CosmosDBResultSet resultSet) throws Exception { CosmosAsyncDatabase getDatabase() throws SQLException { return ((CosmosDBConnection)getConnection()).cosmosDatabase; } - private void getCointainer(String containerName) throws SQLException { + private void getContainer(String containerName) throws SQLException { container = getDatabase().getContainer(containerName); } @@ -223,8 +224,9 @@ private int[] deleteDocument(String idValue, Object partitionKey) throws Excepti statusCode[0] = 404; latch.countDown(); }); - cosmosItemResponseMono.subscribe(); + Disposable d = cosmosItemResponseMono.subscribe(); latch.await(); + d.dispose(); return statusCode; } else @@ -259,9 +261,9 @@ private int[] createDocument(JSONObject jsonObject, Object partitionKey) throws latch.countDown(); }); - cosmosItemResponseMono.subscribe(); + Disposable d = cosmosItemResponseMono.subscribe(); latch.await(); - + d.dispose(); return statusCode; } else { throw new Exception("CosmosDB Insert Execution failed. Invalid json payload."); @@ -296,8 +298,9 @@ private int[] replaceDocument(JSONObject jsonObject, String idValue , Object par latch.countDown(); }); - cosmosItemResponseMono.subscribe(); + Disposable d = cosmosItemResponseMono.subscribe(); latch.await(); + d.dispose(); return statusCode; } else { diff --git a/pom.xml b/pom.xml index 38231aa5b..f78b11f28 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ 4.13.2 1.12.376 2.17.272 - 4.41.0 + 4.42.0 2.19.0 1.19.0