aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Max, finally { unlock} Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Max, finally { unlock}" Watch "Max, finally { unlock}" New topic
Author

Max, finally { unlock}

Vlad Rabkin
Ranch Hand

Joined: Jul 07, 2003
Posts: 555
Hi Max,
Your have following code in the adapter:

What if reserve is successful and modify fails:
You don't have any finally block for realease. It will be a dead-lock.
Did I understand something wrong or you just left this issue open for simplicity?

Tx,
Vlad
Max Habibi
town drunk
( and author)
Sheriff

Joined: Jun 27, 2002
Posts: 4118
Hi Vlad,
Sorry I haven't had a chance to catch up with you lately. I'm ever so slowly climbing out of my cave of work. To answer your question: I actually took an approach here that I advocate for the entire assignment. You don't need to deal with system failure caused deadlock. For example, what if your initial locking failed, and you tried to unlock a record that don't have locked? True, you could safely unlock, but you might be deadlocked out waiting for the monitor. So now you have to code for that. But it has it's own complications, and so on. This is a nasty kettle of fish that really never ends.
You're only responsible for logical deadlock: if you can do that much, Sun will recognize you as a Certified Developer. The type of error you're preventing here can only really occur if something beyond your control happens. Say a JVM failure, or a lightening strike, or a server crash, etc. And if it's beyond your control, then it's beyond your control
M
[ August 18, 2003: Message edited by: Max Habibi ]

Java Regular Expressions
Vlad Rabkin
Ranch Hand

Joined: Jul 07, 2003
Posts: 555
Hi Max,
I like your answers! Your point of view is always very challenging
Ok. Tx a lot.
Vlad
Max Habibi
town drunk
( and author)
Sheriff

Joined: Jun 27, 2002
Posts: 4118
I used to go out a with a girl who would say that: wasn't good then either
M
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Max, finally { unlock}