Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

synchronized vs ReentryReadWriteLock  RSS feed

 
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: 11200
174
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
Boost this thread!