• Post Reply Bookmark Topic Watch Topic
  • New Topic

Concurrency-related question

 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Say I have two java objects i.e. two instances of a request-scoped JSF managed bean. Assume one of the methods in the managed-bean is synchronized.

Do I have ONE lock per class or ONE lock per instance? If the first instance enters the synchronized method and stays within the method of a while, can the second instance enter that synchonized method as well?

Thanks in advance,

Julien Martin.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well if your synchronized method is static then it is a class level lock otherwise it is a instance level lock.
 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!