java - Can I make an overridden method synchronized? -


i overriding method superclass, want method synchronized. allowed? alternative?

yes, it's allowed doesn't change contract implementation.

think add synchronized block :

synchronized(this) {  

just @ start of method, achieve same result. there other (possibly hidden) locks deeper in method, makes part of implementation rather api.


Comments

Popular posts from this blog

php - Magento - Deleted Base url key -

javascript - Tooltipster plugin not firing jquery function when button or any click even occur -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -