Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about lock comment

 
Adam Roberts
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a quick question about a comment before the lock method of one of my files.
It say something to the effect of "no timeout is defined in this method"
Does this mean the programmer is not to place a timeout mechanism in this method or that it is simply not there? ( I was possibly going to use something along these lines, but am not sure exactly how I will implement it, subclassing etc.)
Im assuming its more along the lines of informing the programmer that it has not been created, but it seems the comment is slightly silly considering there is nothing in it .
Just want to be sure
Thanks much
 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect the intent is to tell you that lock() will wait forever - unless you throw an exception, which you might want to do if someone has called lock(-1) with the intent of shutting down the database.
I've heard (read) other comments on the idea of having an existing lock timeout to prevent a dead client from stopping others from accessing a record, but that's for existing locks, not a lock request.
Hope this helps.
 
Adam Roberts
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ahh ok
My (very) general idea was to handle all the locking/unlocking through an intermediate class. This would be able to queue requests if the record was locked and would recieve a flag if the database was being shut down(lock(-1)).
This make any sense?

Thanks much
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This make any sense?

Yes it does. It's called the LockManager. I wish I had had that in my submission, but alas I didn't.
Mark
p.s. OK here is what I originally wanted to write in response to this question.
Yes This makes sense, because this is always this, unless it is that, then that does not make sense. I mean come on now have you ever heard of a correct sentence that had the same word repeated 4 times and still be correct. like in "That that that that boy wrote was good." Now that does not make sense, but this does.
[ March 20, 2002: Message edited by: Mark Spritzler ]
 
Adam Roberts
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yikes
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic