GoogleCloudPlatform / ide-login

The plugins-login-common library for authenticating with the Google Cloud Platform shared by several IDE plugins including Google Cloud Tools for Eclipse, Google Cloud Tools for IntelliJ, and Android Studio.
Apache License 2.0
2 stars 9 forks source link

Make GoogleLoginState thread-safe #21

Open chanseokoh opened 8 years ago

chanseokoh commented 8 years ago

Currently, callers have to be cognitive of and cope with the non-thread-safety on their side, usually by synchronizing on all the public methods.

Ensuring thread-safety will become hairier after adding multi-user login support.

Also need to be careful not to hold a lock while doing long operations such as sending/receiving HTTP requests, persisting OAuthData (which could involve I/O depending on implementations), waiting for UI actions, etc.