aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Question about lock comment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Question about lock comment" Watch "Question about lock comment" New topic
Author

Question about lock comment

Adam Roberts
Ranch Hand

Joined: Mar 18, 2002
Posts: 71
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


Adam Roberts - SCJP2, SCJD<br />insert witty something here
Burk Hufnagel
Ranch Hand

Joined: Oct 01, 2001
Posts: 814
    
    3
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.


SCJP, SCJD, SCEA 5 "Any sufficiently analyzed magic is indistinguishable from science!" Agatha Heterodyne (Girl Genius)
Adam Roberts
Ranch Hand

Joined: Mar 18, 2002
Posts: 71
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

Joined: Feb 05, 2001
Posts: 17249
    
    6

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 ]

Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Adam Roberts
Ranch Hand

Joined: Mar 18, 2002
Posts: 71
Yikes
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about lock comment
 
Similar Threads
Should synchronized methods call other synchronized methods?
Is there a way to ensure gc() will run?
(NX,URLyBird) lock() before readRecord():
Lockmanger- singleton implementation /static creation & assignment in RMI server ?
Thread waiting for another thread