Hi all,

I've discovered that there is a finalizer deadlock in D2WPage when concurrent 
request handler is enabled. As a result, D2W pages cannot be garbage collected 
when its enabled.  The original method looks like

        public void finalize() throws Throwable {
                D2WContext c = d2wContext();
                if (c != null) {
                        c.pageFinalized();
                }
                super.finalize();
        }

The pageFinalized method on D2WContext just deregisters the context from 
observing session timeout notifications and then clears the local values.  If I 
change the method so that it looks like this, everything works fine.

        public void finalize() throws Throwable {
                D2WContext c = d2wContext();
                if (c != null) {
//                      c.pageFinalized();
                        NSNotificationCenter.defaultCenter().removeObserver(c);
                        c._localValues().clear();
                }
                super.finalize();
        }

However, since finalize() is evil, I noticed just commenting out finalize() 
entirely works equally well.  NSNotificationCenter uses weak references, so 
it's not going to prevent garbage collection, and the _localValues() will be 
cleared by the garbage collector.

I'll include the fix in ERDirectToWeb, but I was just wondering... is there any 
reason why I shouldn't just remove the finalize method?

Thanks,

Ramsey

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to