• 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

Uncertain about requirements B&S

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having doubts about what some requirements exactly mean.
Anyone out there to share your thoughts?
Sun provided the interface "DB.java" and states that:
"Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the DB interface".
The locking part in the assignment states:
"Your server must be capable of handling multiple concurrent requests, and as part of this capability, must provide locking functionality as specified in the interface provided above. You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server. Any attempt to lock a resource that is already locked should cause the current thread to give up the CPU, consuming no CPU cycles until the desired resource becomes available."
1. Does this mean that all methods from the DB interface MUST be available to a remote client?
This to allow the marker to lock a record remotely, get a coffee and unlock it after returning?
Currently, all my locking and unlocking is triggered on the server only, and no lock/unlock methods are available to the client code.
2. I think you can avoid throwing a RecordLockedException back to the client by carefully synchronizing methods on the server. Am I right? If so, should I nevertheless foresee the possibility in the client that a record can be locked (this in case the marker follows the aforementioned lock-coffee-unlock sequence)?
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Filip,
You might be interested in reading the thread "Should lock methods be callable by the client" - that should either clear up your doubts about question 1, or confuse you further

I think you can avoid throwing a RecordLockedException back to the client by carefully synchronizing methods on the server. Am I right?


Is RecordLockedException mentioned in the interface provided by Sun? If so, in which methd?
The lock() method certainly shouldn't throw this exception, and I can't see any need for any other methods to throw this exception.
Regards, Andrew
 
Filip Moens
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Andrew,
RecordLockedException is not specified in any of the methods.
I had already found the thread you mentioned and I have been looking at it for quite a while now.
Very interesting, but... well, you know what I mean.
I wonder how the markers proceed in testing the assignment.
Regarding my previous question 1, I wonder if they would take my remote Data Access class and use it directly in code of their own to see if lock/unlock/update/delete etc. works as it should be. In that case, if it's not provided in my classes, I might fail miserably.
Do you have an idea if they take it this far? I don't think they do.
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Filip,
I don't think they go that far.
There are quite a few people who have passed the exam who have had hidden the locking from the client (just had a book() method) and passed. So this does not appear to be something that will cause you to fail.
Regards, Andrew
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic