Created
August 13, 2021 05:32
-
-
Save brownsoo/9038498eb1406ac019e5ac30e6bef8c9 to your computer and use it in GitHub Desktop.
Canceling an Action
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
Scheduler scheduler = Schedulers.newThread(); | |
Scheduler.Worker worker = scheduler.createWorker(); | |
worker.schedule(() -> { | |
result += "First_Action"; | |
worker.unsubscribe(); | |
}); | |
worker.schedule(() -> result += "Second_Action"); | |
Assert.assertTrue(result.equals("First_Action")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment