Hi all,
I have been chasing a race condition for the last 3 days, this is driving me crazy at this point, I have this caching system where I create a Verticle per address with a consumer, similar to an actor system, here is the screenshot of the relevant code, will explain after it:
I have this latch:
CountingLatch startedStoppedLatch = new CountingLatch(2);
I have this completion handler at the consumer:
consumer.completionHandler(event -> startedStoppedLatch.decrement());
and I have this onComplete at when I deploy:
public void deploy(DeploymentOptions deploymentOptions)
{
try {
VertxService.vertx().deployVerticle(this, deploymentOptions).onComplete(event -> startedStoppedLatch.decrement());
startedStoppedLatch.await();
} catch (Exception e) {
log.error("Error deploying processor verticle {}", consumer.address(), e);
}
}
It doesn't matter what I tried, it seems that sending or publishing just after creating the Verticle will have a tiny chance of not delivering the message to the consumer, what am I doing wrong?
Guido.