• Post Reply Bookmark Topic Watch Topic
  • New Topic

Synchronized static methods and plain synchronized methods  RSS feed

 
Kunaal A Trehan
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
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

Rgds Kunal
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!