Last active
July 10, 2016 17:11
-
-
Save amitshekhariitbhu/a7973c61122f65c34dfda419a1f132cf to your computer and use it in GitHub Desktop.
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
/* | |
* Get the future of the task by submitting it to the pool | |
*/ | |
Future future = DefaultExecutorSupplier.getInstance().forBackgroundTasks() | |
.submit(new Runnable() { | |
@Override | |
public void run() { | |
// do some background work here. | |
} | |
}); | |
/* | |
* cancelling the task | |
*/ | |
future.cancel(true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment