• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

About current thread yielding on searching for locked record

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ranchers, my assignment said "Any attempt to lock a resource that is already locked should cause the current thread to give up the CPU" but the lock() method in DB interface said "the current thread gives up the CPU and consumes no CPU cycles until the record is unlocked". On one hand, because it says "should" I don't have to do it. On the other hand, as it is listed in the face, I have to do it.

So my question is: of course we have to implement the interface methods, but do we have to conform to the behavior described in the comment of the methods? Does anyone who passed the exam and didn't implement this behavior?

Thank you.
 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy, Cody!

Well, the instructions say that the interface must be implemented, so I'd say it isn't a good idea to not do what the comments say.

About the "should cause the current thread to give up the CPU" stuff, I'd read it as a must: if the current Thread doesn't give up the CPU, then I really think this can cause automatic failure.
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I even want to add: I know about just a few people who failed and the reason was every time because the current thread wasn't given up the CPU when a record was already locked. So my advice would be: if you want to pass the certification without having to resubmit, implement the interface according to the behavior described in the comment.
 
reply
    Bookmark Topic Watch Topic
  • New Topic