I am reading Java codes to make sure it is thread safe.
As I understand it, any local variables inside the method are thread safe, since it refers to the memory address of the stack. Any class / instance variables are not thread safe, as they relate to heap memory shared by another thread.
By rule of thumb, I can put a synchronized keyword for each method that deals with class variables.
Is there any eclipse plugin or rules that I can analyze / prevent multi-threaded problems?
source
share