Runable

Threading issues of shared resources

Causes 1. problems of analysis

 The same resource is shared by multiple threads

 In carrying out its mandate a thread, the thread resources are other changes

Solution

One

  Synchronized keyword is good enough to mark the task threads, i.e., the synchronization code block, lock - any object

two

  Synchronization method using a lock this

three

  Static method lock synchronization byte code class file object xxx.class       

 

Guess you like

Origin www.cnblogs.com/solemn/p/11578428.html