Skip to content

Instantly share code, notes, and snippets.

@amitshekhariitbhu
Last active July 10, 2016 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitshekhariitbhu/a7973c61122f65c34dfda419a1f132cf to your computer and use it in GitHub Desktop.
Save amitshekhariitbhu/a7973c61122f65c34dfda419a1f132cf to your computer and use it in GitHub Desktop.
/*
* 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