• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SCJD Exam with J2SE 5, Second Edition

 
Pete Palmer
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.
 
Kamal Nassili
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic