Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Urly Bird

Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 12199
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
    What are you doing? You are supposed to be reading this tiny ad!
    free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
      Bookmark Topic Watch Topic
    • New Topic