poorbarcode commented on code in PR #25293:
URL: https://github.com/apache/pulsar/pull/25293#discussion_r2894589407


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TableView.java:
##########
@@ -89,16 +103,13 @@ private T internalReadLatest(String topic) throws 
Exception {
     @VisibleForTesting
     protected Reader<T> getReader(String topic) {
         final var topicName = TopicName.get(topic);
-        return readers.get(topicName.getNamespaceObject(), () -> {
-            try {
-                return wait(readerCreator.apply(topicName), "create reader");
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            }
-        }, __ -> __.closeAsync().exceptionally(e -> {
-            log.warn("Failed to close reader {}", e.getMessage());
-            return null;
-        }));
+        NamespaceName ns = topicName.getNamespaceObject();
+        CompletableFuture<Reader<T>> readerFuture = readers.get(ns, () -> 
readerCreator.apply(topicName), expiration);
+        try {
+            return wait(readerFuture, "create reader");

Review Comment:
   @codelipenghui 
   
   > @poorbarcode Is it better just fix SimpleCache so get() does not run 
valueSupplier under a global synchronized lock? It will avoids per-thread 
TableView growth/leak risk.
   
   Good suggestion, I moved out the logic for waiting for the reader to 
complete its creation



-- 
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]

Reply via email to