Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

3 questions

 
Ray Cheeny
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
still some questions:
1.when the server call lock(-1) and some clients want to get lock, should the server throw Exceptions or blocking?
2.Will getRecord() return null? I think it will throw IOException first. If the db file exits and has no records , what will happen?
3.Does any one use only one DataInfterface? I still confuse with it, though I've looked up others posts. Could anybody tell me how to handle the RemoteException in localAccess?
Thank for reply
 
Svetlana Koshkina
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ray Cheeny:
Hi,
still some questions:
1.when the server call lock(-1) and some clients want to get lock, should the server throw Exceptions or blocking?
2.Will getRecord() return null? I think it will throw IOException first. If the db file exits and has no records , what will happen?
3.Does any one use only one DataInfterface? I still confuse with it, though I've looked up others posts. Could anybody tell me how to handle the RemoteException in localAccess?
Thank for reply

I only can say how I've done it (going to submit this week).
1. I defined TimeoutException: if client thread is waiting for a lock more than specified time (configurable), it will report failure to the client.
2.getRecord() can return null in Data. I'd testet for null value before acting on it.
3.I defined generic interface around Data and subinterfaced it a little bit further for reservation handling.
My user interface communicates with adapter to server-side local interface, which catches RemoteExceptions (from server-side remote inteface, which in turn is also adapter to the local interface) and rethrow them to user interface as another kind of exc.
Sorry for that last one, i am writing docs now and have strong aversion to writing in general and aquired even stronger aversion to writing related to the assignment in particular.
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. I defined TimeoutException: if client thread is waiting for a lock more than specified time (configurable), it will report failure to the client.
In my assignment, the javadoc for the lock() method specifically stated the lock() method should block and no timeouts are defined. If your instructions are the same, I would say you are making a risky design choice.
 
Svetlana Koshkina
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Eugene Kononov:
1. I defined TimeoutException: if client thread is waiting for a lock more than specified time (configurable), it will report failure to the client.
In my assignment, the javadoc for the lock() method specifically stated the lock() method should block and no timeouts are defined. If your instructions are the same, I would say you are making a risky design choice.

Thank you for pointing it out, my assignment sais
"lock method should block until the requested lock can be applied". It is ambigious and can be taken easier, I think: for ex. if I specified timeout for 1hr, will it qualify as a violation of the specification? If it blocks for so long it's going to crash.
I noticed it though, and to be on the safe side I configured my application to block indefinitely . Since it was not very difficult to implement I added this as additional feature for flexibility.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic