Manning's Countdown to 2014
. Use discount code crdotd14 all month for 50% off every deal.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Threads and Synchronization
Synchronized static methods and plain synchronized methods
Kunaal A Trehan
Joined: Feb 04, 2004
Jan 10, 2005 01:25:00
Consider a case where I have 2 methods,1 is synchronized and other is static synchronized.
Both these methods are called from the run mthd().
Lets suppose one thread is calling static synchronized method.Its still under process.
Can another thread call the other non static synchronized method
Joined: Aug 07, 2003
Jan 10, 2005 03:55:00
Synchronized static methods lock the single Class instance while instance (non-static) methods lock the instance of the class on which they are executed. Thus, neither will block the other.
I agree. Here's the link:
subject: Synchronized static methods and plain synchronized methods
Static and Non static Synchronized methods
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013