File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 11777

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
I agree. Here's the link:
subject: NX: About thread safe
It's not a secret anymore!