I have a class ContainerClass that has some static variables. Several simultaneously running threads access these static variables and they always need to have the most recent value.
The threads access the variables without an object of the ContainerClass, but instead like
ContainerClass.variable_A;
Do I still need to declare the variables that are shared between the threads volatile
in ContainerClass? Does any caching happen in the threads?
EDIT: Edited for some clarity.
EDIT2: For more clarity: Multiple threads read the values of these volatile variables, but only one thread sets them. Will the reading-threads cache the variable or always have the up-to-date version, since there's no object instantiation in the reading threads?