File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

synchronized vs ReentryReadWriteLock

 
Helen Ma
Ranch Hand
Posts: 451
  • 0
  • 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: 9208
78
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • 0
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic