[concurrency-interest] retrofitted wait/notify?

David Holmes davidcholmes at aapt.net.au
Tue Aug 31 18:28:16 EDT 2010

Paulo Silveira writes:
> Nowadays every concurrent collection will use ReentrantLock/Syncs (or
> something similar) where we could also use wait/notify.

While there are reasons to replace use of synchronized+wait/notify with
Locks+Conditions you should only do so when it makes sense - it is not
intended that all such uses can or should be converted.

>  I do
> understand the advantages in using the concurrency primitives, so why
> not using AbstractQueuedSynchronizer /UnfairSyncs to implement
> wait/notify instead of its native implementations? There is probably
> an obvious answer, but I cant figuer it out.

wait/notify are tightly intetegrated with monitors so you couldn't use AQS
unless you also replaced monitors with AQS - and that doesn't make sense.

David Holmes

More information about the Concurrency-interest mailing list