This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes NX(URLyBird):About locking : Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "NX(URLyBird):About locking :" Watch "NX(URLyBird):About locking :" New topic
Author

NX(URLyBird):About locking :

biang lin
Ranch Hand

Joined: Jun 02, 2003
Posts: 91
// Locks a record so that it can only be updated or deleted by this client.
// Returned value is a cookie that must be used when the record is unlocked,
// updated, or deleted. If the specified record is already locked by a different
// client, the current thread gives up the CPU and consumes no CPU cycles until
// the record is unlocked.

public long lockRecord(long recNo)
throws RecordNotFoundException;
I don't understand these:
"the current thread gives up the CPU and consumes no CPU cycles until the record is unlocked."
if i write something like:
while(...){
wait();
}
can this "give up the CPU"??


biang
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Yes, wait() will give up the CPU until notify() or notifyAll() is called.


"I'm not back." - Bill Harding, Twister
biang lin
Ranch Hand

Joined: Jun 02, 2003
Posts: 91
Roger,thanks!
Originally posted by Jim Yingst:
Yes, wait() will give up the CPU until notify() or notifyAll() is called.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: NX(URLyBird):About locking :
 
Similar Threads
Elegant solution to waiting without CPU activity?
B&S Is RMI Connection Factory necessary?
client locking row twice
B&S no lock cookies
[ NO PASS!!! ] - What happen???