The idea is that the server, just before it broadcasts the callable tasks to all nodes, creates the semaphore with the desired number of parallel executions. Then the code below makes sure that exactly this number of nodes only run the logic while all other nodes will fail on tryAcquire and return immediately and go back to idle.
Maybe then I misunderstood your requirements then? Regards, Thomas. On 01.06.21 10:18, Krish wrote:
The below implementation may not work for me because if the semaphore is not available then the task won't do any work. I will have to resubmit the same task to do the work that it is supposed to do. DonTequila wrotepublic Object execute() { IgniteSemaphore semaphore = this.ignite.semaphore( "123" , 1 , true, true); boolean acquired = semaphore.tryAquire(); if (acquired) { // run logic semaphore.release(); } }Thanks, Krish -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
