belliottsmith commented on code in PR #91:
URL: https://github.com/apache/cassandra-accord/pull/91#discussion_r1608683139


##########
accord-core/src/main/java/accord/coordinate/CoordinationAdapter.java:
##########
@@ -261,21 +260,50 @@ public void execute(Node node, Topologies all, 
FullRoute<?> route, ExecutePath p
             }
         }
 
-        public static class InclusiveSyncPointAdapter<S extends Seekables<?, 
?>> extends AbstractSyncPointAdapter<S>
+        private static class AbstractInclusiveSyncPointAdapter<S extends 
Seekables<?, ?>> extends AbstractSyncPointAdapter<S>
         {
-            private static final InclusiveSyncPointAdapter INSTANCE = new 
InclusiveSyncPointAdapter();
-        }
 
-        public static class InclusiveSyncPointBlockingAdapter<S extends 
Seekables<?, ?>> extends AbstractSyncPointAdapter<S>
-        {
-            private static final InclusiveSyncPointBlockingAdapter INSTANCE = 
new InclusiveSyncPointBlockingAdapter();
+            protected AbstractInclusiveSyncPointAdapter()
+            {
+                super();
+            }
 
             @Override
             public void execute(Node node, Topologies all, FullRoute<?> route, 
ExecutePath path, TxnId txnId, Txn txn, Timestamp executeAt, Deps deps, 
BiConsumer<? super SyncPoint<S>, Throwable> callback)
             {
                 ExecuteBlocking<S> execute = ExecuteBlocking.atQuorum(node, 
all, new SyncPoint<>(txnId, deps, (S)txn.keys(), route), executeAt);
-                execute.addCallback(callback);
                 execute.start();
+                // If there are no deps to wait on then everything is already 
applied
+                // If this is the async adapter then we want to invoke the 
callback immediately
+                // and the caller can wait on the txn locally if they want
+                if (deps.isEmpty() || this == 
AsyncInclusiveSyncPointAdapter.INSTANCE)

Review Comment:
   I don't think `deps.isEmpty()` is a good test to apply as in a real cluster 
this should almost never be true; also not super keen on testing equality with 
an instance object, should maybe just have an overridable 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.

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