| Author |
Urly Bird
|
Mohamed Amri
Greenhorn
Joined: Feb 17, 2006
Posts: 11
|
|
Hi, Would it be ok if you can have a look at the solution I've suggested for the UrlyBird assignement I've used RMI as network mode the locks methods are called within the methods implemented within the Data class (create, remove and book). The method that books a record starts by bookLock() and end up with bookUnlock() and all the methods run on the server side, so if the same client tries to book the same record twice at the same time, on the server side there will be two different threads that will call {bookLock(), update(recNo) and bookUnlock}, and the record locking solution will be valid and the server does not need to know if the client is trying to lock the record for the second time without releasing the record lock. what do you think about that your advices will be very appreciated Mohamed Best Regards
|
 |
Andrew Monkhouse
author and jackaroo
Marshal Commander
Joined: Mar 28, 2003
Posts: 10815
|
|
Hi Mohamed, Welcome to JavaRanch and this forum. When talking about "create, remove and book", are you talking about Some methods that are in another class that you have created? If so, this could work. Some methods that you have added to your version of the Data interface that are not specified in the provided interface? If so, then I would advise against doing this. The interface you have been provided should work with any data format (hence the name of your class: Data). It is not an URLyBird specific class. But for the book() method to work correctly, it will have to have some idea of what is an available record so that it does not re-book a record that has already been booked. If your book() method is in the Data class then you are putting business logic inside a class that neither needs, nor should have, business logic. the methods specified by your interface (I thought the methods specified were the standard CRUD methods: Create, Read, Update, Delete) with a few extras for finding and locking records. If so, then I recommend you see my earlier point regarding business logic. There is a reason why the lock() and unlock() methods are exposed to the users of the Data class. Regards, Andrew
|
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
|
 |
 |
|
|
subject: Urly Bird
|
|
|