• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Urly Bird

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
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 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
     
    Dinner will be steamed monkey heads with a side of tiny ads.
    Gift giving made easy with the permaculture playing cards
    https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
    reply
      Bookmark Topic Watch Topic
    • New Topic