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

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -