• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is this in my design redundant ?

 
Zhou Can
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did store not the clientID, but the creating time of the lock in my LockManager hashtable . When the server is on , a thread always checks the time and current time to judge if the lock is expired . This expired lock will be removed from the lock hashtable . The expired lock appears after some client lock and book seats in a flight , this clients failed .
Is my design redundant ?
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not required, but it isn't harmful either. What might be harmful though is that it sounds like you're not satisfying the javadoc for unlock().
- Peter
 
Max Habibi
town drunk
( and author)
Sheriff
Posts: 4118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to stay from this sort of thing. The assignment does not ask you to deal with 'lost' locks, nor to provide timeouts. SO doing so gets you nothing, but increases the potential that a mistake will be made, and increases the complexity of the code.
You best bet, IMO, is to concentrate on bare bones features.
All best,
M, author
The Sun Certified Java Developer Exam with J2SE 1.4
 
Rajesh So
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does providing Tineouts to locks , a violation of the guidelines?
 
Max Habibi
town drunk
( and author)
Sheriff
Posts: 4118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IMO, it does. offering time outs is not a requirement, and you were specifically told to prefer a simple design.
The people assessing your exam will not be impressed by your implementation, no matter how clever: they will be frustrated in trying to figure why you wrote unnecessary code, and how it might have had a negative impact on the requirements you were supposed to meet.
By an large, the SCJD should be treated as a exercise in coloring inside the lines. My advice is to do exactly what was asked, do it in the most orthodox method possible, learn the material you need to, and earn your certification.
All best,
M, author
The Sun Certified Java Developer Exam with J2SE 1.4
[ December 21, 2002: Message edited by: Max Habibi ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic