[ 
https://issues.apache.org/jira/browse/MIME4J-72?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12638431#action_12638431
 ] 

Markus Wiederkehr commented on MIME4J-72:
-----------------------------------------

@Oleg

Indeed there seems to be a lot to disagree about. If disagreement is so common 
on this list then please let me continue ;-)

Regarding the dispose method.. With finalizers being the flawed thing they are 
explicit close/dispose/destroy methods are the closest thing in Java we have to 
a destructor. Please take a look at 
http://docs.google.com/View?docid=dffxznxr_1nmsqkz, a proposal for Java 7 from 
Joshua Bloch. That interface Foo he talks about corresponds to the Disposable 
interface I have introduced in Mime4j.

So this is not something I have invented or has never been heard of before. I 
like separation of concerns but why should something as elementary as object 
destruction be a separate concern?

Regarding the visitor. Please take a look at the GoF Design Patterns book page 
339, the section "Who is reponsible for traversing the object structure?" You 
can put the traversal in, I quote, "the object structure, in the visitor or in 
a separate iterator object". And later "The main reason to put the traversal in 
the visitor is to implement a particular complex traversal...". That complex 
traversal is what we need and there is no common pattern.

> Provide a means to dispose a Message
> ------------------------------------
>
>                 Key: MIME4J-72
>                 URL: https://issues.apache.org/jira/browse/MIME4J-72
>             Project: JAMES Mime4j
>          Issue Type: Improvement
>    Affects Versions: 0.5
>            Reporter: Markus Wiederkehr
>            Assignee: Robert Burrell Donkin
>         Attachments: entityvisitor.patch, mime4j-disposable.patch, 
> mime4j-dispose-finalize.patch, mime4j-dispose-no-clutter.patch, 
> mime4j-dispose-visitor.patch
>
>
> Currently an org.apache.james.mime4j.message.Message uses temporary files to 
> store text and binary attachments of the message. Unfortunately a Message 
> cannot be disposed of explicitly. Even when it eventually gets garbage 
> collected the temp files continue to exist until the VM exits.
> If the VM runs for a long time and a lot of e-mails get processed this can 
> become a major problem.
> For this reason I think that class Entity and interface Body should both have 
> a method to dispose of the object. Multipart should dispatch a dispose-call 
> to its list of body parts. A BodyPart should dispose of its body and concrete 
> Body implementation such as TempFileTextBody should ultimately invoke 
> delete() on the backing TempFile.
> Last but not least SimpleTempStorage$SimpleTempFile should not silently 
> ignore delete-calls.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to