henrikingo commented on code in PR #53:
URL: https://github.com/apache/cassandra-accord/pull/53#discussion_r1290555915


##########
accord-core/src/main/java/accord/coordinate/CoordinatePreAccept.java:
##########
@@ -253,7 +259,13 @@ void onNewEpoch(Topologies prevTopologies, Timestamp 
executeAt, List<PreAcceptOk
     public void accept(T success, Throwable failure)
     {
         if (failure instanceof CoordinationFailed)
+        {
             ((CoordinationFailed) failure).set(txnId, route.homeKey());
+            if (failure instanceof Preempted)
+                node.agent().metricsEventsListener().onPreempted(txnId);
+            else if (failure instanceof Timeout)
+                node.agent().metricsEventsListener().onTimeout(txnId);
+        }

Review Comment:
   This if-else construct seems to be recurring quite many times. Wouldn't it 
make sense to move this into the `metricsEventsListener` and here just call 
some generic method:
   
       node.agent().metricsEventListener().onFailure(failure);



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