aspose file tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes NX: About thread safe Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "NX: About thread safe" Watch "NX: About thread safe" New topic

NX: About thread safe

Bigwood Liu
Ranch Hand

Joined: Feb 26, 2003
Posts: 240
Does anyone know why there is not synchronized any key word in DBAccess class? lock/unlock is not enough. There are many articles discussed that before.
Jonathan Liu

Joined: Aug 21, 2003
Posts: 26
DBAccess is an interface, so there is no need to define synchronized here.
And it's your subclass's responsibility to implement this
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11670

Hi Damu,
Jonathan is almost correct.
Because DBAccess is an interface, it is illegal to mark any of it's methods synchronized. See the JLS.
Regards, Andrew

The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
It is sorta covered in the JavaRanch Style Guide.
subject: NX: About thread safe