Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it ok to synchronize a overridden method in a subclass which is not synchronized in parent class?

I have a derived class, and for some reason, I have to make two methods of this class synchronized to prevent them executing at the same time. One of the methods is an overridden method. Parent method is not synchronized.

Is it ok to synchronize the overridden method?

like image 730
Lahiru Chandima Avatar asked Nov 14 '25 12:11

Lahiru Chandima


1 Answers

Look here: https://stackoverflow.com/a/15998431/5226711

synchronized is not part of the method signature.

So it is okay to synchronize the overridden method.

like image 60
Lars Gendner Avatar answered Nov 17 '25 07:11

Lars Gendner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!