Re: Can't modify EO objects! ARGH! =(
Re: Can't modify EO objects! ARGH! =(
- Subject: Re: Can't modify EO objects! ARGH! =(
- From: Chuck Hill <email@hidden>
- Date: Tue, 22 Jul 2003 10:03:11 -0700
At 09:26 PM 21/07/2003 -1000, Art Isbell wrote:
>
> If I read the WO 5.2 documentation correctly, a nested editing context
>uses the lock of its parent, so if its parent is the session's default
>editing context, there's no need to lock it.
>
No, that is a documentation defect. I think it is supposed to read, "A
nested editing context uses the *same NSRecursiveLock instance* as its
parent". However, this code
parentsLock.lock();
Is *not* equivalent to
public void lock() {
// Do some stuff
parentsLock.lock();
// Do some other stuff
}
Assuming that the lock() method does nothing other than call lock() on the
parent's lock is dangerous and, my experiments suggest, very incorrect.
The undocumented reverse is in fact true: locking the child *does* lock the
parent.
> Locking does impose a small performance penalty and can lead to
>deadlocks if not done correctly.
>
And not locking can lead to unpredictable disaster. :-)
>> Concurrent request handling is a WOF feature.
>
> True, but unless the programmer creates new threads herself,
>concurrent request handling will be the source of the multiple threads
>that an editing context might need to deal with.
>
Yes, we if choose to ignore the existence of WOLongResponsePage, session
terminator thread, finalizer thread...
java != SingleThreaded
>So in the usual
>situation without concurrent request handling (i.e., no
>programmer-created threads), is there any exposure of an editing
>context to multiple threads?
Yes! Proper locking or Russian Roulette, the choice is yours!
Chuck
--
Chuck Hill email@hidden
Global Village Consulting Inc. http://www.global-village.net
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.