You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mime4j-dev@james.apache.org by Ro...@Dell.com on 2012/01/12 21:42:10 UTC

Message.dispose()

After reading the comments in MIME4J-72, it is still unclear how this ended up being implemented, and what users of the API need to do to clean up resources.

So my question is: Do I need to manually traverse the message and dispose of every disposable object in the message, or only call dispose on the outermost message object itself? Another words, if I call Message.dispose(), does that recursively clean up all of its constituent objects, or must I do that?

Thanks,
Rob L

Robert Lee
Software Engineer
Dell | Services Product Group

2401 Greenlawn Blvd.
Mailstop RR 7 - 29
Round Rock, TX 78682

Direct: (512) 513-5916


Re: Message.dispose()

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2012-01-12 at 14:42 -0600, Robert_E_Lee@Dell.com wrote:
> After reading the comments in MIME4J-72, it is still unclear how this ended up being implemented, and what users of the API need to do to clean up resources.
> 
> So my question is: Do I need to manually traverse the message and dispose of every disposable object in the message, or only call dispose on the outermost message object itself? Another words, if I call Message.dispose(), does that recursively clean up all of its constituent objects, or must I do that?
> 
> Thanks,
> Rob L
> 
> Robert Lee
> Software Engineer
> Dell | Services Product Group
> 
> 2401 Greenlawn Blvd.
> Mailstop RR 7 - 29
> Round Rock, TX 78682
> 
> Direct: (512) 513-5916
> 

Since no one else responded so far, here's my take. Message#dispose must
also ensure deallocation of resources held by child objects. So,
effectively parent is expected to traverse its children and invoke
#dispose method on objects being traversed. If this is not the case,
please raise a JIRA for the defect.

Oleg