-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Future #1286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Future #1286
Conversation
Just use CAS loop instead of synchronized and two boolean variables.
| executionList = localExecutionList; | ||
| executionListInitialized = true; | ||
| } | ||
| for (;;) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you meant. Loop is not needed indeed. I've updated the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was exactly my thought. :)
|
Nice catch, thanks! I do have a question though. |
It allows execution of future callback in completion thread, and makes `ListenableFuture` closer to `CompletableFuture` (which allows `null` executor). It also saves a little memory in `toCompletableFuture` implementation.
|
Wait! I made a mistake in Revert it please. |
|
Going to submit alternative patch. |
|
@stepancheg I deleted the commit |
Two patches improving futures.
AbstractListenableFuture.executionListinitializationnullexecutor inListenableFuture