A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: synchronized vs ReentryReadWriteLock
wait() in synchronized code ??
About Object lock
Is a monitor the same thing as a lock?
Creating multiple children threads
how can i achieve a 100% thread safty method ?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015