Last active
August 29, 2015 14:27
-
-
Save stream-iori/dad083d13947996bf1bc to your computer and use it in GitHub Desktop.
Handler Atomic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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