[concurrency-interest] Is it still ok to use synchronized after all these years?

达子 fslzdd at gmail.com
Fri Nov 12 21:42:46 EST 2010


I thought Tim and Yao shared good points. Brian Goetz summarizes the usage
of ReentrantLock here:
http://www.ibm.com/developerworks/java/library/j-jtp10264/.

"Use it when you need something it provides that synchronized doesn't, like
timed lock waits, interruptible lock waits, non-block-structured locks,
multiple condition variables, or lock polling. ReentrantLock also has
scalability benefits."

Thanks!

2010/11/13 Ashwin Jayaprakash <ashwin.jayaprakash at gmail.com>

> I was wondering if it is still ok to use the "synchronized" keyword instead
> of ReentrantLock where it is convenient.
>
> Or is it thought of as an anachronism?
>
> Does synchronized still have a better internal implementation over
> j.u.c.Lock as this old blog entry says -
> http://blogs.sun.com/dave/entry/java_util_concurrent_reentrantlock_vs ?
>
>
> Thanks,
> Ashwin Jayaprakash.
>
> PS: Doug Lea - if you are reading this, I hope you will continue to make
> your awesome contributions to the JDK! I can't imagine what it would be like
> without the j.u.c code.
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20101113/291722bc/attachment.html>


More information about the Concurrency-interest mailing list