A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
Developer Certification (SCJD/OCMJD)
synchronized vs ReentryReadWriteLock
Joined: Nov 01, 2011
Jun 19, 2012 11:27:11
1. sychronized (obj) means aquiring the lock of the object.
2. Consider the lock:
ReentryReadWriteLock lock = new ReentryReadWriteLock(); lock.writeLock().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
Joined: Jul 19, 2004
Jun 20, 2012 12:43:34
First of all: ReentryReadWriteLock is an unexisting class in JDK. I guess you meant
Secondly I think Anayonkar Shivalkar gave an excellent explanation about that part of the new concurrency api in
, SCJP (
I agree. Here's the link:
subject: synchronized vs ReentryReadWriteLock
About Object lock
how can i achieve a 100% thread safty method ?
wait() in synchronized code ??
Creating multiple children threads
Is a monitor the same thing as a lock?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013