Skip to content
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

Add volatile keyword for double check locking #1655

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
4 participants
@arodionov
Copy link

commented Apr 4, 2019

This PR provides additional volatile keyword in order to prevent potential instructions reordering. For more info see: http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

@pivotal-issuemaster

This comment has been minimized.

Copy link

commented Apr 4, 2019

@arodionov Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-issuemaster

This comment has been minimized.

Copy link

commented Apr 4, 2019

@arodionov Thank you for signing the Contributor License Agreement!

@OlegDokuka

This comment has been minimized.

Copy link

commented Apr 27, 2019

@jgrandja can you please take a look at this tiny PR

@jgrandja

This comment has been minimized.

Copy link
Contributor

commented Apr 30, 2019

@OlegDokuka I don't understand why volatile is needed here? OAuth2AccessTokenSupport.restTemplate is initialized on first access to getRestTemplate(), which obtains a lock before it's initialized. So I don't see the need unless I'm missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.