Java synchronizing static list ?
- by JavaUser
Hi,
In a Java class , i am having a static list so this list is shared across all the objects of this class.The business logic in this class will run periodically which is invoked by some method with out passing instance parameters.Now I want to invoke this run method based on the list(I will add some vales into this list based on JMS) ,this list may empty sometimes and after finishing the run , i am emptying this list.Now my question is , whether I need to synchronize this list or not?
Also let me know is there any other way to pass value in one object instance(Thread1) to other object instance (Thread2) other than having Static variable(static list)?
Thx