On 2010-09-04, at 2:04 AM, Chuck Hill wrote:

> 
> On Sep 3, 2010, at 2:53 PM, Farrukh Ijaz wrote:
> 
>> Hi,
>> 
>> Is there a way to check if the editingContext is disposed?
> 
> There is, but it is not exposed.
> 
> 
>> I guess there should be something called isDisposed(), it is useful for 
>> following scenario.
>> 
>> private EOEditingContext _editingContext;
>> 
>> public EOEditingContext editingContext() {
>>      if(_editingContext == null || _editingContext.isDisposed()) {
>>              _editingContext = ERXEC.newEditingContext();
>>      }
>>      return _editingContext;
>> }
>> 
>> This ensures that whenever the call is made to editingContext(), the editing 
>> context will be valid.
>> 
>> Just a thought.
> 
> 
> I can't think of a good coding practice that would want that code.  dispose() 
> is normally called by finalization.  If you dispose of your ECs manually, 
> earlier, you should either null the reference or replace the EC.  That would 
> be good coding practice.  Keeping a reference to a disposed EC seems... 
> undesirable.

I've seen this in practice (good or bad I don't know) when we needed to process 
large amount of data and nullifying EC or replacing EC was not releasing the 
memory consumed by original EC (monitored using JConsole), the call to 
dispose() released the memory. What would be the reason then? Perhaps terribly 
bad code or are there any strong references to EC?

Farrukh

> 
> Chuck
> 
> -- 
> Chuck Hill             Senior Consultant / VP Development
> 
> Practical WebObjects - for developers who want to increase their overall 
> knowledge of WebObjects or who are trying to solve specific problems.    
> http://www.global-village.net/products/practical_webobjects
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/farrukh.ijaz%40fuegodigitalmedia.com
> 
> This email sent to [email protected]

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

This email sent to [email protected]

Reply via email to