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
Post a Comment