[concurrency-interest] general performance question

David Holmes davidcholmes at aapt.net.au
Thu Dec 22 04:38:42 EST 2011


Roel Spilker writes:
> You can use http://projectlombok.org/features/Synchronized.html as a way
> to use a private lock object AND (potentially) have static analysis.
>
> Can anyone explain to me why an overridden method should be synchronized
> as well?

Generally the overridden method needs to conform to the synchronization
protocol employed by the base class. It would be rare to override a
synchronized method and not also need to be synchronized.

David
-----

> Roel
>
> Disclosure: I'm involved in Project Lombok
>
> On 21-12-2011 17:45, Nathan Reynolds wrote:
> > On the other hand, "synchronized(this)" will trigger Eclipse or
> > FindBugs to warn you that the code is synchronizing on a publicly
> > accessible object.  This means that if another piece of code
> > synchronizes on the object then there might be an unintended
> > scalability problem.
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>



More information about the Concurrency-interest mailing list