You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/06/04 18:46:22 UTC

[GitHub] [pulsar] sijie commented on a change in pull request #4437: [pulsar-broker] Fix race condition of read-timeout task in ML

sijie commented on a change in pull request #4437: [pulsar-broker] Fix race condition of read-timeout task in ML
URL: https://github.com/apache/pulsar/pull/4437#discussion_r290442203
 
 

 ##########
 File path: managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
 ##########
 @@ -1603,91 +1603,94 @@ static ReadEntryCallbackWrapper create(String name, long ledgerId, long entryId,
             return readCallback;
         }
 
-        public boolean isTimedOut(long timeoutSec) {
-            return this.createdTime != -1
-                    && TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - this.createdTime) >= timeoutSec
-                    && this.readCompleted == FALSE;
-        }
-
         @Override
         public void readEntryComplete(Entry entry, Object ctx) {
-            if (checkCallbackCompleted(ctx)) {
+            long reOpCount = (ctx != null && ctx instanceof Long) ? (long) ctx : 0;
 
 Review comment:
   I see this pattern is repeated many times. Can we abstract this logic into a common method or rewrite those methods using this pattern into one common method?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services