java - are there any different levels of synchronization? -


i have heard there different levels of synchronization.are there?(if there ,would please explain them snippet code?)thanks.

before java 5 there one: synchronized keyword. waited , obtained exclusive lock on reference object. when applied function:

public synchronized void dostuff() { ... } 

the object being synchronized on this.

java 5 added lot of concurrency utils, 1 of lock object. there several versions of including readwritelock. thing can think of might referring to.

the problem synchronized crude. done badly can lead deadlocks. java 5 utils allow non-blocking lock acquisition, timeout on lock acquisition , read/write lock support.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -