Skip to content

Instantly share code, notes, and snippets.

@stream-iori
Last active August 29, 2015 14:27
Show Gist options
  • Select an option

  • Save stream-iori/dad083d13947996bf1bc to your computer and use it in GitHub Desktop.

Select an option

Save stream-iori/dad083d13947996bf1bc to your computer and use it in GitHub Desktop.
Handler Atomic
final AtomicInteger counter = new AtomicInteger(0);
vertx.eventBus().send("address1", "args", event -> {
//some logic
counter.incrementAndGet();
next();
});
vertx.eventBus().send("address2", "args", event -> {
//some logic
counter.incrementAndGet();
netx();
});
public void next() {
if (counter.get() == 2) {
System.out.println("success.");
} else {
System.out.println("wait.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment