Leanplum / Leanplum-Android-SDK

Leanplum's integrated solution delivers meaningful engagement across messaging and the in-app experience.
https://www.leanplum.com
Apache License 2.0
46 stars 40 forks source link

Fix VarCache.variants thread-safety #441

Closed hborisoff closed 3 years ago

hborisoff commented 3 years ago
What Where/Who
JIRA Issue SDK-342
People Involved @hborisoff

VarCache.variants is practically read only. Making the reference volatile will make it immediately visible from all threads, if changed. No need for other synchronisation, because iterating over the elements from multiple threads won't produce any exception.