• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Design choices and Synchronization

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

I am working on the SCJD assignment URLyBird 1.3.3. I have the following question about the design choice for implementing mandatory features in the UI -

While going through the SCJD book by Andrew Monkhouse and Terry Camerlengo, I noticed that all the methods provided in the DBClient Interface are not exposed as actions in the UI (For Example: Adding a DVD or removing a DVD, NOT return or rent). Does that mean if instructions don't specifically mandate us to expose all the methods present in the Interface provided by Sun as actions in the UI, we can use our discretion. Would that be a candidate for design choice?

Also, I have another question regarding the synchronization from the SCJD book.

In the book, you are synchronizing the database object (RandomAccessFile) in the persistDVD method. I noticed that database object is a static variable. I understand that only one user will have the lock on this at any given time as long as all the users accessing the Application using the same JVM, but if I invoke the application in the "alone" from my machine twice. Then, I assume they are running in two different JVMs. If I am able to somehow update the same record from both the sessions (let us assume this is possible - may be two users sharing the same server), will there not be a problem. Or, am I not understanding something here.

Thank you for your inputs.

Thanks
Ravi
[ February 11, 2007: Message edited by: Ravikiran Vishnuvajhala ]
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11865
194
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ravikiran,
... if instructions don't specifically mandate us
Check your instructions for text like "You will not receive extra credit points for work beyond the requirements of the specification." If you have this, then you do not have to do anything that is not mandated.
Would that be a candidate for design choice?
... but if I invoke the application in the "alone" from my machine twice. ...
Check your instructions from Sun for text along the lines of "You may assume that at any moment, at most one program is accessing the database file". If you have that text, then you do not need to worry about the case where someone starts two instances of the client or two instances of the server.

Regards, Andrew
 
Ravikiran Vishnuvajhala
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


"You may assume that at any moment, at most one program is accessing the database file"


It was my mistake in interpreting this!!!.

Thank you for your answers Andrew.

- Ravi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic