These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Dispose behavior of Invoke on LazyInitializer
PostPosted: Mon May 17, 2010 8:58 am 
Newbie

Joined: Mon Oct 26, 2009 4:53 pm
Posts: 2
Hello,

Depending on the return value of LazyInitializer's Invoke(), and subsequent logic in Intercept(), the method may be invoked on the implementation object instead of the proxy. However, because of the special-casing of calls to "Dispose" within Invoke, the return value of Invoke will be null, and Dispose will not be called on the implementation. This bypasses some custom logic that we have on our objects (which perform various cleanup operations when Dispose is called on them).

So, my question is whether there is a significant risk to invoking Dispose on the implementation of a proxy? We are currently overriding LazyInitializer's Intercept, such that it passes Dispose calls on to the implementation regardless of the return value of Invoke. So far, it doesn't seem to cause any unexpected behavior, but I figured there must be some good reason for Invoke's treatment of Dispose. We're effectively ignoring Invoke's handling of Dispose, and doing the exact opposite of what it's trying to prevent.

Does anyone happen to know the reason why LazyInitializer's Invoke is coded to prevent Dispose calls from reaching the implementation?

Thanks,

-Dan


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.