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

rest - Spring boot: Request method 'PUT' not supported -

php - Magento - Deleted Base url key -

symfony - imagine_filter() not generating the correct url in LiipImagineBundle -