use of com.linkedin.kafka.cruisecontrol.async.progress.WaitingForClusterModel in project cruise-control by linkedin.
the class LoadMonitor method acquireForModelGeneration.
/**
* Acquire the semaphore for the cluster model generation.
* @param operationProgress the progress for the job.
* @throws InterruptedException
*/
public AutoCloseableSemaphore acquireForModelGeneration(OperationProgress operationProgress) throws InterruptedException {
if (_acquiredClusterModelSemaphore.get()) {
throw new IllegalStateException("The thread has already acquired the semaphore for cluster model generation.");
}
WaitingForClusterModel step = new WaitingForClusterModel();
operationProgress.addStep(step);
_clusterModelSemaphore.acquire();
_acquiredClusterModelSemaphore.set(true);
step.done();
return new AutoCloseableSemaphore();
}
Aggregations