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 Unlocking the entire database? 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 "Unlocking the entire database?" Watch "Unlocking the entire database?" New topic
Author

Unlocking the entire database?

John Sinues
Ranch Hand

Joined: Feb 21, 2000
Posts: 52
When lock(-1) is called, we are suppose to lock the entire database. How do we unlock it? Can we assume unlock(-1) unlocks the entire database?
- John Sinues
Padmaja Prasad
Ranch Hand

Joined: Nov 14, 2001
Posts: 76
Same way as lock(-1). You can loop through all records and call recursively unlock(record) for each record.
Padmaja
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Or not implement unlock(-1) and put in your design.txt that lock(-1) should only be used for the server to shutdown the server, and that unlocking the records then would be pointless.
Mark


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

Joined: Feb 21, 2000
Posts: 52
Thanks Mark, I like that approach.
- John
Abhinav Anand
Ranch Hand

Joined: May 02, 2002
Posts: 113
Hi,

Or not implement unlock(-1) and put in your design.txt that lock(-1) should only be used for the server to shutdown the server, and that unlocking the records then would be pointless.

What about the scenario when you have to add a record and you need to lock the whole database. Is it justified to assume that no records will be added at all in future.
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
Vishal,
Why do you have to lock the entire database to insert one record?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unlocking the entire database?
 
Similar Threads
Lock the database
URLybird locking
Question with Habibi's Locking Example
database unlock()
Implementing Lock/Unlock