Skip to content

Instantly share code, notes, and snippets.

@ashkrit
Created January 16, 2014 14:06
Show Gist options
  • Save ashkrit/8455533 to your computer and use it in GitHub Desktop.
Save ashkrit/8455533 to your computer and use it in GitHub Desktop.
Task Rejection
if (isRunning(c) && workQueue.offer(command)) {
int recheck = ctl.get();
if (! isRunning(recheck) && remove(command))
reject(command);
else if (workerCountOf(recheck) == 0)
addWorker(null, false);
}
else if (!addWorker(command, false))
reject(command);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment