This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

SCJD Exam with J2SE 5, Second Edition

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am slowly working through this book and have a few questions regarding it that I hope can be clarified. Firstly, I would like to appologise that I am not able to copy extracts from the book that would have been better.

Question 1 - Chapter 3 Projects Overview page 68.
On this page, there are number of customer usecases defined addDVD, getDVD, modifyDVD, findDVD, releaseDVD, reserverDVD & removeDVD.
However, on the client GUI, only the findDVD, releaseDVD, reserverDVD are supported. Any reason, why the other operations are not supported ?

Question 2 - Chapter 5 DVDDatabase Class - ReservationsManager Class.

a) The ReservationsManager Class provides a reserveDVD(). The client thread acquires a lock on the reservations object which is effectively on all the reserved DVDs. Should this lock be on the specific DVD of interest ?

b) A further query on the reserveDVD(). If a client(A) thread wants to reserve a DVD that has already been reserved by another client (B) thread than client(A) thread will call the await(). The call could timeout after 5 seconds or, in this scenario, woken up because say client(C) thread returned a DVD which is not the one client (A) thread wants to reserve. Client(A) thread will check the reservations map and detect that the DVD on interest is still resevered and, will therefore, call await() again. This behaviour of client(A) thread could repeat again. My query is that if client (A) thread call to reservedDVD() could return after more that 5 seconds. Is this correct ?

c) The reservations map defined to hold the DVDs that are reserved is defined as

Map <String, DvdDatabase> reservations new HaspMap <String, DvdDatabase> ()

The key to this map is a the String which is effectively the UPC ( Universal Product Code ) for a specific DVD title. I take this to mean all copies of this DVD will have the UPC.
As the UPC value can't differentiate between copies of the DVD, than, the reservations map will ONLY ever have ONE entry for the a DVD reserved by a client. So if there are many copies of a DVD than it looks like only client can reserve (rent) at any one time. Is this correct ?


Sorry it is a lengthy and specific to the book question.

Pete.
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I think the code is not complete and w have to implement the missing stuff...
 
A timing clock, fuse wire, high explosives and a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic