Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Urly Bird  RSS feed

Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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

Best Regards
author and jackaroo
Marshal Commander
Posts: 12168
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • 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
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!