andresbeckruiz commented on code in PR #360:
URL: https://github.com/apache/cassandra-sidecar/pull/360#discussion_r3539128353


##########
server/src/main/java/org/apache/cassandra/sidecar/job/OperationalJobManager.java:
##########
@@ -131,4 +150,26 @@ private void checkConflict(OperationalJob job) throws 
OperationalJobConflictExce
             throw new OperationalJobConflictException("The same operational 
job is already running on Cassandra. operationName='" + job.name() + '\'');
         }
     }
+
+    /**
+     * For jobs that require cluster-wide coordination, attempts to acquire 
the active operation lock
+     * via the coordinator. Throws a conflict if another operation is already 
active.
+     *
+     * @param job instance of the job to coordinate
+     * @throws OperationalJobConflictException when the coordinator cannot 
activate the operation
+     */
+    private void tryCoordination(OperationalJob job) throws 
OperationalJobConflictException
+    {
+        if (job.requiresCoordination())
+        {
+            Preconditions.checkState(coordinator != null,
+                                     "Job requires coordination but no 
OperationalJobCoordinator is configured");
+            boolean activated = coordinator.trySetActive(job.operationType(), 
job.jobId());

Review Comment:
   Added in 
[954454d](https://github.com/apache/cassandra-sidecar/pull/360/commits/954454d691b30637f260657f327dca522c97107b)



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