阅读背景:

同步块中对象级别的锁和类级别的锁 —— Thread synchronization, object level locking and class level locking

来源:互联网 

Java supports multiple threads to be executed. This may cause two or more threads to access the same fields or objects. Synchronization is a process which keeps all concurrent threads in execution to be in synch. Synchronization avoids memory consistence errors caused due to inconsistent view of shared memory. When a method is declared as synchronized; the thread holds the monitor for that method’s object If another thread is executing the synchronized method, your thread is blocked until that thread releases the monitor.Java supports multiple threads to be executed.




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: