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.
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.