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 Why locking in SCJD 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 "Why locking in SCJD" Watch "Why locking in SCJD" New topic
Author

Why locking in SCJD

Leo Tien
Ranch Hand

Joined: Sep 10, 2002
Posts: 156
Hi all:
After read this thread, I have a question, why use locking in SCJD? I think it never be asked before, so I post it in new thread.
Because I confused on locking mechanism yet, so my idea may be not exact.
First, this is sun's requirement:
Your server must be capable of handling multiple concurrent requests, and as part of this capability, must provide locking functionality as specified in the interface provided above.

Second, synchronized and lock/unlock mechanism are different things at all:

If use synchronized method, the search and book operation are equally blocked on DB Access Layer, one operation must waiting till another active operation is finished. No request cache, no response cache. Your server is "multiple-request-single-response" schema.
If use lock/unlock, condition is different obviously. Because have a book operation cache, your server is "multiple-request-multiple-response" schema.
What are you thinking on this? Pls comment !
Leo Tien
Ranch Hand

Joined: Sep 10, 2002
Posts: 156
Every body have no idea about this???
Max Habibi
town drunk
( and author)
Sheriff

Joined: Jun 27, 2002
Posts: 4118
Hi Leo,
Nice diagram. Mind if I add it to the FAQs?
To answer your question. Yes, you're right. There are ways to do achieve this functionality without locking. However, the requirements state that you much provide locking in order to pass.
M
[ February 11, 2004: Message edited by: Max Habibi ]

Java Regular Expressions
Leo Tien
Ranch Hand

Joined: Sep 10, 2002
Posts: 156
Hi Max:
Nice diagram. Mind if I add it to the FAQs?

Never mind, I'd like to do that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why locking in SCJD
 
Similar Threads
How to cope with situations that should never occur?
pls validate my locking strategy - all inputs are g8ly appreciated. (URLyBird)
URLyBird:1.2.1 Accessing the database
NX: About Locking
NX: Locking and Unlocking and Sun's Must Conditions