You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Gabor Kincses <np...@yahoo.com> on 2005/01/13 02:06:04 UTC

RE: Disabling the spool in James 2.2.0?

--- Steve Short <ss...@postx.com> wrote:

[snip]

 - James uses temp files in the
> java.io.tmpdir to store the
> messages while they are still being received.  Only
> when the message is
> complete is it then stored in the spool repository
> as the
> FileStreamStore and a FileObjectStore files you
> mention.

Ok, I found it.  MimeMessageInputStreamSource should
really be called MimeMessageFileInputStreamSource,
then a MimeMessageByteArrayInputStreamSource could be
written, which stores the freshly parsed out message
in  a static hash of ByteArrayInputStreams instead of
temp files.  The dispose method would remove the entry
from the hash.

Am I making sense?

Thanks,
Gabor

P.S. Oops, I'm drifting into -dev territory...

> 
> Cheers
> Steve
> 


=====
Gabor Kincses
Running Mandrake Linux 10.0


		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: Disabling the spool in James 2.2.0?

Posted by Serge Knystautas <se...@lokitech.com>.
Gabor Kincses wrote:
>>Memory allocation and garbage collection. 
>>http://jakarta.apache.org/commons/io
> 
> Makes sense.  I'll give it a spin.
> 
> BTW, I thought you meant the avalon commons.  I'm only
> familiar with bits and pieces of jakarta...

Ah, sorry.  Avalon is closed, so I expect we'll move to rely on Jakarta 
libraries more.

-- 
Serge Knystautas
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: Disabling the spool in James 2.2.0?

Posted by Gabor Kincses <np...@yahoo.com>.
--- Serge Knystautas <se...@lokitech.com> wrote:

> Gabor Kincses wrote:
> > Why?  Is it the synchronization overhead?
> > 
> > Which one should I use?  I'm not finding anything
> > other than the java.io.
> 
> Memory allocation and garbage collection. 
> http://jakarta.apache.org/commons/io

Makes sense.  I'll give it a spin.

BTW, I thought you meant the avalon commons.  I'm only
familiar with bits and pieces of jakarta...

Thanks,
Gabor

> > --- Serge Knystautas <se...@lokitech.com> wrote:
> > 
> > 
> >>Gabor Kincses wrote:
> >>
> >>>Ok, I found it.  MimeMessageInputStreamSource
> >>
> >>should
> >>
> >>>really be called
> MimeMessageFileInputStreamSource,
> >>>then a MimeMessageByteArrayInputStreamSource
> could
> >>
> >>be
> >>
> >>>written, which stores the freshly parsed out
> >>
> >>message
> >>
> >>>in  a static hash of ByteArrayInputStreams
> instead
> >>
> >>of
> >>
> >>>temp files.  The dispose method would remove the
> >>
> >>entry
> >>
> >>>from the hash.
> >>
> >>Sounds good, though I'd recommend using commons
> io's
> >>
> >>bytearrayoutputstream instead of the one with the
> >>JDK.
> >>
> >>-- 
> >>Serge Knystautas
> >>Lokitech >> software . strategy . design >>
> >>http://www.lokitech.com
> >>p. 301.656.5501
> >>e. sergek@lokitech.com
> >>
> >>
> > 
> >
>
---------------------------------------------------------------------
> > 
> >>To unsubscribe, e-mail:
> >>server-dev-unsubscribe@james.apache.org
> >>For additional commands, e-mail:
> >>server-dev-help@james.apache.org
> >>
> >>
> > 
> > 
> > 
> > =====
> > Gabor Kincses
> > Running Mandrake Linux 10.0
> > 
> > 
> > 		
> > __________________________________ 
> > Do you Yahoo!? 
> > Yahoo! Mail - now with 250MB free storage. Learn
> more.
> > http://info.mail.yahoo.com/mail_250
> 
> 
> -- 
> Serge Knystautas
> Lokitech >> software . strategy . design >>
> http://www.lokitech.com
> p. 301.656.5501
> e. sergek@lokitech.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail:
> server-dev-help@james.apache.org
> 
> 


=====
Gabor Kincses
Running Mandrake Linux 10.0


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: Disabling the spool in James 2.2.0?

Posted by Serge Knystautas <se...@lokitech.com>.
Gabor Kincses wrote:
> Why?  Is it the synchronization overhead?
> 
> Which one should I use?  I'm not finding anything
> other than the java.io.

Memory allocation and garbage collection. 
http://jakarta.apache.org/commons/io

> --- Serge Knystautas <se...@lokitech.com> wrote:
> 
> 
>>Gabor Kincses wrote:
>>
>>>Ok, I found it.  MimeMessageInputStreamSource
>>
>>should
>>
>>>really be called MimeMessageFileInputStreamSource,
>>>then a MimeMessageByteArrayInputStreamSource could
>>
>>be
>>
>>>written, which stores the freshly parsed out
>>
>>message
>>
>>>in  a static hash of ByteArrayInputStreams instead
>>
>>of
>>
>>>temp files.  The dispose method would remove the
>>
>>entry
>>
>>>from the hash.
>>
>>Sounds good, though I'd recommend using commons io's
>>
>>bytearrayoutputstream instead of the one with the
>>JDK.
>>
>>-- 
>>Serge Knystautas
>>Lokitech >> software . strategy . design >>
>>http://www.lokitech.com
>>p. 301.656.5501
>>e. sergek@lokitech.com
>>
>>
> 
> ---------------------------------------------------------------------
> 
>>To unsubscribe, e-mail:
>>server-dev-unsubscribe@james.apache.org
>>For additional commands, e-mail:
>>server-dev-help@james.apache.org
>>
>>
> 
> 
> 
> =====
> Gabor Kincses
> Running Mandrake Linux 10.0
> 
> 
> 		
> __________________________________ 
> Do you Yahoo!? 
> Yahoo! Mail - now with 250MB free storage. Learn more.
> http://info.mail.yahoo.com/mail_250


-- 
Serge Knystautas
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Verification of sent mails

Posted by Christophe Laumond <cl...@motet.dk>.
Hi,

We have created a mailet for sending bulk mails. When
all mails have been sent via the bulk mailet it should
respond with a receipt email containing a list of the
recipients and whether each recipient 'received' the
email or not. By 'received' I mean sent from the mail
server succesfully.

Are there any way to verify that the emails has been
sent succesfully so I can create a receipt email like
this? I thougt a bit about modifying the LocalDelivery
and RemoteDelivery mailets and store the state
information there but I am not really sure whether
this is the way to go.

Does anyone have any suggestions on how to create this
receipt email?


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: Disabling the spool in James 2.2.0?

Posted by Gabor Kincses <np...@yahoo.com>.
--- Serge Knystautas <se...@lokitech.com> wrote:

[snip]

> 
> Actually, make a copy of AvalonMailRepository and
> AvalonSpoolRepository, 
> calling them MemoryMailRepository and
> MemorySpoolRepository (or 
> whatever).

Ok, reworked my code to fit your spec.  Attached are
the changes.  Note the inner class:
MemorySpoolRepository$MemoryStreamRepository.

As far as my first change is concerned
(MimeMessageByteArrayInputStreamSource vs.
MimeMessageFileInputStreamSource), can that also be
selected from the configuration?

>  At the end of your config file, you can
> see how to define 
> memory: as a mail and spool repository that points
> to that new class. 
> Then for various configurations you could switch
> from file://foobar to 
> memory://foobar.

Almost.  memory://fubar blows ugly chunks.  I had to
change references to Avalon* to Memory* and the
File_Persistent_Stream_Repository to
MemorySpoolRepository$MemoryStreamRepository.

> This would allow us to bundle your in-memory version
> and let people 
> switch as they want.
> 
> -- 
> Serge Knystautas
> Lokitech >> software . strategy . design >>
> http://www.lokitech.com
> p. 301.656.5501
> e. sergek@lokitech.com
> 


=====
Gabor Kincses
Running Mandrake Linux 10.0


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250

Re: Disabling the spool in James 2.2.0?

Posted by Serge Knystautas <se...@lokitech.com>.
Gabor Kincses wrote:
> After replacing the file-based spool with an in-memory
> spool implementation and eliminating a per-message
> WARN and an INFO log-message and dropping the hidden
> PostMasterAlias-mailet, the performance went to
> ~16,600 messages/min.  At this point james and the
> client split the CPU evenly, indicating that james
> probably would have gone up to ~30,000 messages/min on
> a 3GHz P4, Win2k, JDK1.5.0_01, NTFS with a message
> size of 10.9kB.

Sounds good.  At ~10kb/message, that's ~300 mb/min or 5mb/s?  Sounds 
pretty nice.

> I'll attach my changes if there's any interest.

I would like some of your improvements, though notes below.

> Initially, there were stability issues, since zero
> file i/o lead to lock-ups (of james _and_ Windows,
> thread priorities?), which I countered by introducing
> a forced wake-up from wait() calls every 100
> milliseconds and forcing a Thread.yield() after each
> notify() call for good measure (the yield() probably
> would have been sufficient, I just dread the missed
> notifies syndrome). 
> 
> BTW, I don't really like wait()/notify(), I much
> prefer Doug Lea's synchronization primitives,
> LinkedQueue would probably work here.

Since Doug Lea's advanced thread-handling library is available as a 
separate download pre-JDK 1.5, we /should/ be able to bundle it with 
James and support our current JVMs.

My point being, I'm all behind switching our current approach to one 
that uses a solid thread-switching library.

> The in-memory spool repository does not interfere with
> the other mail repositories, since the
> AvalonMailRepository class was not changed; all the
> change is in AvalonSpoolRepository.  One caveat: spool
> recovery is of course meaningless after a crash.

Actually, make a copy of AvalonMailRepository and AvalonSpoolRepository, 
calling them MemoryMailRepository and MemorySpoolRepository (or 
whatever).  At the end of your config file, you can see how to define 
memory: as a mail and spool repository that points to that new class. 
Then for various configurations you could switch from file://foobar to 
memory://foobar.

This would allow us to bundle your in-memory version and let people 
switch as they want.

-- 
Serge Knystautas
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: Disabling the spool in James 2.2.0?

Posted by Gabor Kincses <np...@yahoo.com>.
Here are results from a very contrived configuration. 
I'll attempt measurement with a more meaningful
configuration later.

After replacing the file-based spool with an in-memory
spool implementation and eliminating a per-message
WARN and an INFO log-message and dropping the hidden
PostMasterAlias-mailet, the performance went to
~16,600 messages/min.  At this point james and the
client split the CPU evenly, indicating that james
probably would have gone up to ~30,000 messages/min on
a 3GHz P4, Win2k, JDK1.5.0_01, NTFS with a message
size of 10.9kB.

I'll attach my changes if there's any interest.

Initially, there were stability issues, since zero
file i/o lead to lock-ups (of james _and_ Windows,
thread priorities?), which I countered by introducing
a forced wake-up from wait() calls every 100
milliseconds and forcing a Thread.yield() after each
notify() call for good measure (the yield() probably
would have been sufficient, I just dread the missed
notifies syndrome). 

BTW, I don't really like wait()/notify(), I much
prefer Doug Lea's synchronization primitives,
LinkedQueue would probably work here.

The in-memory spool repository does not interfere with
the other mail repositories, since the
AvalonMailRepository class was not changed; all the
change is in AvalonSpoolRepository.  One caveat: spool
recovery is of course meaningless after a crash.

No time to profile, yet,
Gabor

--- Gabor Kincses <np...@yahoo.com> wrote:

> After replacing the one-byte at a time copy with 1k,
> 4k and 4k+commons-io's ByteArrayOutputStream, the
> performance rose to ~7300 messages/min.  The various
> settings didn't make much difference, not too
> surprisignly since the test messages are 10.9kB a
> piece.
> 
> Time to profile.
> 
> Hope this helps,
> Gabor
> 
> --- Gabor Kincses <np...@yahoo.com> wrote:
> 
> > Ok.  Attached is the new version using a byte[] to
> > store the mime message.  The other change is in
> > MailImpl.java to instantiate the new class. 
> > Performance went from ~5500 10.9kB messages/min to
> > ~6800 messages/min.
> > 
> > --- Gabor Kincses <np...@yahoo.com> wrote:
> > 
> > > Why?  Is it the synchronization overhead?
> > > 
> > > Which one should I use?  I'm not finding
> anything
> > > other than the java.io.
> > > 
> > > Thanks,
> > > Gabor
> > > 
> > > --- Serge Knystautas <se...@lokitech.com>
> wrote:
> > > 
> > > > Gabor Kincses wrote:
> > > > > Ok, I found it. 
> MimeMessageInputStreamSource
> > > > should
> > > > > really be called
> > > MimeMessageFileInputStreamSource,
> > > > > then a MimeMessageByteArrayInputStreamSource
> > > could
> > > > be
> > > > > written, which stores the freshly parsed out
> > > > message
> > > > > in  a static hash of ByteArrayInputStreams
> > > instead
> > > > of
> > > > > temp files.  The dispose method would remove
> > the
> > > > entry
> > > > > from the hash.
> > > > 
> > > > Sounds good, though I'd recommend using
> commons
> > > io's
> > > > 
> > > > bytearrayoutputstream instead of the one with
> > the
> > > > JDK.
> > > > 
> > > > -- 
> > > > Serge Knystautas
> > > > Lokitech >> software . strategy . design >>
> > > > http://www.lokitech.com
> > > > p. 301.656.5501
> > > > e. sergek@lokitech.com
> > > > 
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > server-dev-unsubscribe@james.apache.org
> > > > For additional commands, e-mail:
> > > > server-dev-help@james.apache.org
> > > > 
> > > > 
> > > 
> > > 
> > > =====
> > > Gabor Kincses
> > > Running Mandrake Linux 10.0
> > > 
> > > 
> > > 		
> > > __________________________________ 
> > > Do you Yahoo!? 
> > > Yahoo! Mail - now with 250MB free storage. Learn
> > > more.
> > > http://info.mail.yahoo.com/mail_250
> > > 
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > server-dev-unsubscribe@james.apache.org
> > > For additional commands, e-mail:
> > > server-dev-help@james.apache.org
> > > 
> > > 
> > 
> > =====
> > Gabor Kincses
> > Running Mandrake Linux 10.0
> > 
> > 
> > 	
> > 		
> > __________________________________ 
> > Do you Yahoo!? 
> > Yahoo! Mail - You care about security. So do we. 
> > http://promotions.yahoo.com/new_mail>
>
/***********************************************************************
> >  * Copyright (c) 2000-2004 The Apache Software
> > Foundation.             *
> >  * All rights reserved.                           
>  
> >                   *
> >  *
> >
>
-------------------------------------------------------------------
> > *
> >  * Licensed under the Apache License, Version 2.0
> > (the "License"); you *
> >  * may not use this file except in compliance with
> > the License. You    *
> >  * may obtain a copy of the License at:           
>  
> >                   *
> >  *                                                
>  
> >                   *
> >  *     http://www.apache.org/licenses/LICENSE-2.0 
>  
> >                   *
> >  *                                                
>  
> >                   *
> >  * Unless required by applicable law or agreed to
> in
> > writing, software *
> >  * distributed under the License is distributed on
> > an "AS IS" BASIS,   *
> >  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
> > either express or     *
> >  * implied.  See the License for the specific
> > language governing       *
> >  * permissions and limitations under the License. 
>  
> >                   *
> > 
> >
>
***********************************************************************/
> > 
> > package org.apache.james.core;
> > 
> > import java.io.*;
> > 
> > import javax.mail.MessagingException;
> > 
> > import
> > org.apache.avalon.framework.activity.Disposable;
> > 
> > /**
> >  * Takes an input stream and creates a repeatable
> > input stream source
> >  * for a MimeMessageWrapper.  It does this by
> > completely reading the
> >  * input stream and saving that to a temporary
> file
> > that should delete on exit,
> >  * or when this object is GC'd.
> >  *
> >  * @see MimeMessageWrapper
> >  *
> >  *
> >  */
> > public class MimeMessageByteArrayInputStreamSource
> >     extends MimeMessageSource
> >     implements Disposable {
> >     
> >     /**
> >      * Random key into the cache
> >      */
> >     String sourceId = null;
> > 
> >     /**
> >      * The mime bytes
> >      */
> >     byte[] bytes = null;
> >     
> >     /**
> >      * @param key
> >      * @param in
> >      * @throws MessagingException
> >      */
> >     /**
> >      * Construct a new
> > MimeMessageByteArrayInputStreamSource from an
> >      * <code>InputStream</code> that contains the
> 
=== message truncated ===


=====
Gabor Kincses
Running Mandrake Linux 10.0


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: Disabling the spool in James 2.2.0?

Posted by Gabor Kincses <np...@yahoo.com>.
After replacing the one-byte at a time copy with 1k,
4k and 4k+commons-io's ByteArrayOutputStream, the
performance rose to ~7300 messages/min.  The various
settings didn't make much difference, not too
surprisignly since the test messages are 10.9kB a
piece.

Time to profile.

Hope this helps,
Gabor

--- Gabor Kincses <np...@yahoo.com> wrote:

> Ok.  Attached is the new version using a byte[] to
> store the mime message.  The other change is in
> MailImpl.java to instantiate the new class. 
> Performance went from ~5500 10.9kB messages/min to
> ~6800 messages/min.
> 
> --- Gabor Kincses <np...@yahoo.com> wrote:
> 
> > Why?  Is it the synchronization overhead?
> > 
> > Which one should I use?  I'm not finding anything
> > other than the java.io.
> > 
> > Thanks,
> > Gabor
> > 
> > --- Serge Knystautas <se...@lokitech.com> wrote:
> > 
> > > Gabor Kincses wrote:
> > > > Ok, I found it.  MimeMessageInputStreamSource
> > > should
> > > > really be called
> > MimeMessageFileInputStreamSource,
> > > > then a MimeMessageByteArrayInputStreamSource
> > could
> > > be
> > > > written, which stores the freshly parsed out
> > > message
> > > > in  a static hash of ByteArrayInputStreams
> > instead
> > > of
> > > > temp files.  The dispose method would remove
> the
> > > entry
> > > > from the hash.
> > > 
> > > Sounds good, though I'd recommend using commons
> > io's
> > > 
> > > bytearrayoutputstream instead of the one with
> the
> > > JDK.
> > > 
> > > -- 
> > > Serge Knystautas
> > > Lokitech >> software . strategy . design >>
> > > http://www.lokitech.com
> > > p. 301.656.5501
> > > e. sergek@lokitech.com
> > > 
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > server-dev-unsubscribe@james.apache.org
> > > For additional commands, e-mail:
> > > server-dev-help@james.apache.org
> > > 
> > > 
> > 
> > 
> > =====
> > Gabor Kincses
> > Running Mandrake Linux 10.0
> > 
> > 
> > 		
> > __________________________________ 
> > Do you Yahoo!? 
> > Yahoo! Mail - now with 250MB free storage. Learn
> > more.
> > http://info.mail.yahoo.com/mail_250
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > server-dev-unsubscribe@james.apache.org
> > For additional commands, e-mail:
> > server-dev-help@james.apache.org
> > 
> > 
> 
> =====
> Gabor Kincses
> Running Mandrake Linux 10.0
> 
> 
> 	
> 		
> __________________________________ 
> Do you Yahoo!? 
> Yahoo! Mail - You care about security. So do we. 
> http://promotions.yahoo.com/new_mail>
/***********************************************************************
>  * Copyright (c) 2000-2004 The Apache Software
> Foundation.             *
>  * All rights reserved.                             
>                   *
>  *
>
-------------------------------------------------------------------
> *
>  * Licensed under the Apache License, Version 2.0
> (the "License"); you *
>  * may not use this file except in compliance with
> the License. You    *
>  * may obtain a copy of the License at:             
>                   *
>  *                                                  
>                   *
>  *     http://www.apache.org/licenses/LICENSE-2.0   
>                   *
>  *                                                  
>                   *
>  * Unless required by applicable law or agreed to in
> writing, software *
>  * distributed under the License is distributed on
> an "AS IS" BASIS,   *
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
> either express or     *
>  * implied.  See the License for the specific
> language governing       *
>  * permissions and limitations under the License.   
>                   *
> 
>
***********************************************************************/
> 
> package org.apache.james.core;
> 
> import java.io.*;
> 
> import javax.mail.MessagingException;
> 
> import
> org.apache.avalon.framework.activity.Disposable;
> 
> /**
>  * Takes an input stream and creates a repeatable
> input stream source
>  * for a MimeMessageWrapper.  It does this by
> completely reading the
>  * input stream and saving that to a temporary file
> that should delete on exit,
>  * or when this object is GC'd.
>  *
>  * @see MimeMessageWrapper
>  *
>  *
>  */
> public class MimeMessageByteArrayInputStreamSource
>     extends MimeMessageSource
>     implements Disposable {
>     
>     /**
>      * Random key into the cache
>      */
>     String sourceId = null;
> 
>     /**
>      * The mime bytes
>      */
>     byte[] bytes = null;
>     
>     /**
>      * @param key
>      * @param in
>      * @throws MessagingException
>      */
>     /**
>      * Construct a new
> MimeMessageByteArrayInputStreamSource from an
>      * <code>InputStream</code> that contains the
> bytes of a
>      * MimeMessage.
>      *
>      * @param key the prefix for the name of the
> temp file
>      * @param in the stream containing the
> MimeMessage
>      *
>      * @throws MessagingException if an error occurs
> while trying to store
>      *                            the stream
>      */
>     public
> MimeMessageByteArrayInputStreamSource(String key,
> InputStream in)
>             throws MessagingException {
>         //We want to immediately read this into a
> byte array
>         //Create a byte array and channel the input
> stream into it
>         OutputStream out = null;
>         ByteArrayOutputStream bout = null;
>         try {
>             out = new BufferedOutputStream(bout =
> new ByteArrayOutputStream());
>             int b = -1;
>             while ((b = in.read()) != -1) {
>                 out.write(b);
>             }
>             out.flush();
>             sourceId = key;
>             bytes =  bout.toByteArray();
>         } catch (IOException ioe) {
>             throw new MessagingException("Unable to
> retrieve the data: " + ioe.getMessage(), ioe);
>         } finally {
>             try {
>                 if (out != null) {
>                     out.close();
>                 }
>             } catch (IOException ioe) {
>                 // Ignored - logging unavailable to
> log this non-fatal error.
>             }
> 
>             try {
>                 if (in != null) {
>                     in.close();
>                 }
>             } catch (IOException ioe) {
>                 // Ignored - logging unavailable to
> log this non-fatal error.
>             }
>         }
>     }
> 
>     /**
>      * Returns the unique identifier of this input
> stream source
>      *
>      * @return the unique identifier for this
> MimeMessageByteArrayInputStreamSource
>      */
>     public String getSourceId() {
>         return sourceId;
>     }
> 
>     /**
>      * Get an input stream to retrieve the data
> stored in the temporary file
>      *
>      * @return a <code>BufferedInputStream</code>
> containing the data
>      */
>     public synchronized InputStream getInputStream()
> throws IOException {
>         return new BufferedInputStream(new
> ByteArrayInputStream(bytes));
>     }
> 
>     /**
>      * Get the size of the temp file
>      *
>      * @return the size of the temp file
>      *
>      * @throws IOException if an error is encoutered
> while computing the size of the message
>      */
>     public long getMessageSize() throws IOException
> {
>         return bytes.length;
>     }
> 
>     /**
>      * @see
>
org.apache.avalon.framework.activity.Disposable#dispose()
>      */
>     public void dispose() {
>         bytes = null;
>     }
> 
>     /**
>      * <p>Finalizer that closes and deletes the temp
> file.  Very bad.</p>
>      * We're leaving this in temporarily, while also
> establishing a more
>      * formal mechanism for cleanup through use of
> the dispose() method.
>      *
>      */
>     public void finalize() {
>         dispose();
>     }
> }
> 
> >
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail:
server-dev-help@james.apache.org


=====
Gabor Kincses
Running Mandrake Linux 10.0


	
		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: Disabling the spool in James 2.2.0?

Posted by Gabor Kincses <np...@yahoo.com>.
Ok.  Attached is the new version using a byte[] to
store the mime message.  The other change is in
MailImpl.java to instantiate the new class. 
Performance went from ~5500 10.9kB messages/min to
~6800 messages/min.

--- Gabor Kincses <np...@yahoo.com> wrote:

> Why?  Is it the synchronization overhead?
> 
> Which one should I use?  I'm not finding anything
> other than the java.io.
> 
> Thanks,
> Gabor
> 
> --- Serge Knystautas <se...@lokitech.com> wrote:
> 
> > Gabor Kincses wrote:
> > > Ok, I found it.  MimeMessageInputStreamSource
> > should
> > > really be called
> MimeMessageFileInputStreamSource,
> > > then a MimeMessageByteArrayInputStreamSource
> could
> > be
> > > written, which stores the freshly parsed out
> > message
> > > in  a static hash of ByteArrayInputStreams
> instead
> > of
> > > temp files.  The dispose method would remove the
> > entry
> > > from the hash.
> > 
> > Sounds good, though I'd recommend using commons
> io's
> > 
> > bytearrayoutputstream instead of the one with the
> > JDK.
> > 
> > -- 
> > Serge Knystautas
> > Lokitech >> software . strategy . design >>
> > http://www.lokitech.com
> > p. 301.656.5501
> > e. sergek@lokitech.com
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > server-dev-unsubscribe@james.apache.org
> > For additional commands, e-mail:
> > server-dev-help@james.apache.org
> > 
> > 
> 
> 
> =====
> Gabor Kincses
> Running Mandrake Linux 10.0
> 
> 
> 		
> __________________________________ 
> Do you Yahoo!? 
> Yahoo! Mail - now with 250MB free storage. Learn
> more.
> http://info.mail.yahoo.com/mail_250
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail:
> server-dev-help@james.apache.org
> 
> 

=====
Gabor Kincses
Running Mandrake Linux 10.0


	
		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail

Re: Disabling the spool in James 2.2.0?

Posted by Gabor Kincses <np...@yahoo.com>.
Why?  Is it the synchronization overhead?

Which one should I use?  I'm not finding anything
other than the java.io.

Thanks,
Gabor

--- Serge Knystautas <se...@lokitech.com> wrote:

> Gabor Kincses wrote:
> > Ok, I found it.  MimeMessageInputStreamSource
> should
> > really be called MimeMessageFileInputStreamSource,
> > then a MimeMessageByteArrayInputStreamSource could
> be
> > written, which stores the freshly parsed out
> message
> > in  a static hash of ByteArrayInputStreams instead
> of
> > temp files.  The dispose method would remove the
> entry
> > from the hash.
> 
> Sounds good, though I'd recommend using commons io's
> 
> bytearrayoutputstream instead of the one with the
> JDK.
> 
> -- 
> Serge Knystautas
> Lokitech >> software . strategy . design >>
> http://www.lokitech.com
> p. 301.656.5501
> e. sergek@lokitech.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail:
> server-dev-help@james.apache.org
> 
> 


=====
Gabor Kincses
Running Mandrake Linux 10.0


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: Disabling the spool in James 2.2.0?

Posted by Serge Knystautas <se...@lokitech.com>.
Gabor Kincses wrote:
> Ok, I found it.  MimeMessageInputStreamSource should
> really be called MimeMessageFileInputStreamSource,
> then a MimeMessageByteArrayInputStreamSource could be
> written, which stores the freshly parsed out message
> in  a static hash of ByteArrayInputStreams instead of
> temp files.  The dispose method would remove the entry
> from the hash.

Sounds good, though I'd recommend using commons io's 
bytearrayoutputstream instead of the one with the JDK.

-- 
Serge Knystautas
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org