Candibiotic
News Update :

Concurrent Access Problems ,Synchronized Threads

Friday, August 21, 2009

synchronized methods prevent more than one thread from accessing an object's critical method code simultaneously.
You can use the synchronized keyword as a method modifier, or to start a synchronized block of code.
To synchronize a block of code (in other words, a scope smaller than the whole method), you must specify an argument that is the object whose lock you want to synchronize on.
While only one thread can be accessing synchronized code of a particular instance, multiple threads can still access the same object's unsynchronized code.
When a thread goes to sleep, its locks will be unavailable to other threads.
static methods can be synchronized, using the lock from the java.lang.Class instance representing that class.
Share this Article on :

0 comments:

Post a Comment

 

© Copyright Vinayak Wins 2010 -2011 | Design by Herdiansyah Hamzah | Published by Borneo Templates | Powered by Blogger.com.