wood burning stoves 2.0*
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "NX: About thread safe" Watch "NX: About thread safe" New topic
Author

NX: About thread safe

Bigwood Liu
Ranch Hand

Joined: Feb 26, 2003
Posts: 240
Hi,
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.
Regards,
Damu
Jonathan Liu
Greenhorn

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: 11490
    
  95

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: http://aspose.com/file-tools
 
subject: NX: About thread safe