• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

synchronized vs ReentryReadWriteLock

 
Helen Ma
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. sychronized (obj) means aquiring the lock of the object.
2. Consider the lock:


For synchronize keyword, it locks the object.
For lock, it does not lock any object. This lock is an indicator that indicates the code below it is mutal exclusive.
Is this true?
 
Roel De Nijs
Sheriff
Posts: 9934
113
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all: ReentryReadWriteLock is an unexisting class in JDK. I guess you meant ReentrantReadWriteLock.

Secondly I think Anayonkar Shivalkar gave an excellent explanation about that part of the new concurrency api in this post.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic