dcapwell commented on code in PR #101:
URL: https://github.com/apache/cassandra-accord/pull/101#discussion_r1663161581


##########
accord-core/src/main/java/accord/local/Node.java:
##########
@@ -285,31 +286,24 @@ public void onEpochRedundant(Ranges ranges, long epoch)
         topology.onEpochRedundant(ranges, epoch);
     }
 
-    public AsyncChain<?> awaitEpoch(long epoch)
-    {
-        if (topology.hasEpoch(epoch))
-            return AsyncResults.SUCCESS_VOID;
-        configService.fetchTopologyForEpoch(epoch);
-        return topology.awaitEpoch(epoch);
-    }
-
-    public AsyncChain<?> awaitEpoch(@Nullable EpochSupplier epochSupplier)
+    public void withEpoch(EpochSupplier epochSupplier, BiConsumer<Void, 
Throwable> callback)
     {
         if (epochSupplier == null)
-            return AsyncResults.SUCCESS_VOID;
-        return awaitEpoch(epochSupplier.epoch());
+            callback.accept(null, null);
+        else
+            withEpoch(epochSupplier.epoch(), callback);
     }
 
-    public void withEpoch(long epoch, Runnable runnable)
+    public void withEpoch(long epoch, BiConsumer<Void, Throwable> callback)
     {
         if (topology.hasEpoch(epoch))
         {
-            runnable.run();
+            callback.accept(null, null);
         }
         else
         {
             configService.fetchTopologyForEpoch(epoch);
-            topology.awaitEpoch(epoch).addCallback(runnable).begin(agent);
+            topology.awaitEpoch(epoch).addCallback(callback).begin((ignored1, 
ignored2) -> {});

Review Comment:
   my point was that if the callback fails the failure is hidden... by keeping 
the agent we will detect such cases.  Now, because `callback` doesn't finish 
the chain you would need to do something else... 
   
   thinking about it, why have `callback` and `begin`... why not just use 
`begin` directly?



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