tolbertam commented on code in PR #2003:
URL: 
https://github.com/apache/cassandra-java-driver/pull/2003#discussion_r1938352194


##########
core/src/main/java/com/datastax/oss/driver/internal/core/cql/CqlPrepareAsyncProcessor.java:
##########
@@ -141,25 +195,23 @@ public CompletionStage<PreparedStatement> process(
       String sessionLogPrefix) {
 
     try {
-      CompletableFuture<PreparedStatement> result = 
cache.getIfPresent(request);
-      if (result == null) {
-        CompletableFuture<PreparedStatement> mine = new CompletableFuture<>();
-        result = cache.get(request, () -> mine);
-        if (result == mine) {
-          new CqlPrepareHandler(request, session, context, sessionLogPrefix)
-              .handle()
-              .whenComplete(
-                  (preparedStatement, error) -> {
-                    if (error != null) {
-                      mine.completeExceptionally(error);
-                      cache.invalidate(request); // Make sure failure isn't 
cached indefinitely
-                    } else {
-                      mine.complete(preparedStatement);
-                    }
-                  });
-        }
-      }
-      return result;
+      CompletableFuture<PreparedStatement> rv = new CompletableFuture<>();

Review Comment:
   Since we're creating a brand new future, If the CacheEntry already exists 
and is completed, won't we return a `CompletableFuture` that never completes?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to