Hi Israel,

just to give you some more ideas about the "proxy stuff"...

The MimeMessageCopyOnWrite proxy take care of help to "delay" saves on
the MimeMessage as much as possible plus trying to share the same
MimeMessage as long as possible for different Mail objects. This helps
in terms of Memory...


Bye,
Norman


2010/4/13 Israel Tsadok <[email protected]>:
> (This is just for completeness).
> What I ended up doing was basically copy the process from JDBCMailRepository
> store/retrieve methods, except putting the data in an output stream instead
> of a prepared statement.
>
>            ObjectOutputStream oos = new ...
>
>            oos.writeObject(mail.getName());
>            oos.writeObject(mail.getState());
>            oos.writeObject(mail.getErrorMessage());
>            oos.writeObject(mail.getSender());
>            StringBuffer recipients = new StringBuffer();
>            for (Iterator i = mail.getRecipients().iterator(); i.hasNext();
> ) {
>                recipients.append(i.next().toString());
>                if (i.hasNext()) {
>                    recipients.append("\r\n");
>                }
>            }
>            oos.writeObject(recipients.toString());
>
>            oos.writeObject(mail.getRemoteHost());
>            oos.writeObject(mail.getRemoteAddr());
>            oos.writeObject(mail.getLastUpdated());
>            MimeMessageUtil.writeTo(mail.getMessage(), oos, oos);
>            oos.close()
>
> When deserializing I do the exact opposite, with this magic at the end,
> copied from JDBCMailRepository.retrieve():
>
>            MimeMessageInputStreamSource source = new
> MimeMessageInputStreamSource("temp", ois);
>            MimeMessageCopyOnWriteProxy message = new
> MimeMessageCopyOnWriteProxy(source);
>            mail.setMessage(message);
>
> I'm not 100% clear on what exactly goes on with the proxy business, but it
> seems to work.
> Thanks for replying.
>
> Israel.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to