When are the message headers actually fetched?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Friday, April 26, 2002 12:57 AM

Hi, we are using the JavaMail API in a webmail application, and I'm currently trying to make the response as fast as possible when the user is browsing through the list of message headers by prefetching mail headers that it is likely that the user asks to see next. More specifically, when a user asks to see message headers 20-29, say, we fetch and return these, but at the same time we start two threads that fetch message headers 10-19 and 30-39. The idea is then obviously to exploit the fact that these message headers will be cached in JavaMail, so that we can serve headers 30-39 faster to the user when (if :-) the next request comes. My question is: at which point does JavaMail actually go to the mail    More>>

Hi,

we are using the JavaMail API in a webmail application, and I'm currently trying to make the response as fast as possible when the user is browsing through the list of message headers by prefetching mail headers that it is likely that the user asks to see next.

More specifically, when a user asks to see message headers 20-29, say, we fetch and return these, but at the same time we start two threads that fetch message headers 10-19 and 30-39. The idea is then obviously to exploit the fact that these message headers will be cached in JavaMail, so that we can serve headers 30-39 faster to the user when (if :-) the next request comes.

My question is: at which point does JavaMail actually go to the mail server (IMAP in our case) and fetch the message headers? We have to make sure that the prefetching threads thet we start results in the message headers actually being loaded from the IMAP server into JavaMail objects, or we won't get the caching effect we want.

In particular, are all the following lines of code necessary to make the IMAP server actually return the mail headers to JavaMail, or could we skip the loop, for instance?:

			
Message[] msg = folder.getMessages(start,end);
folder.fetch(msg, fp);
for(int i=0; i
String subject = msg[i].getSubject();
}



Morten Bjørhus

   <<Less

Re: When are the message headers actually fetched?

Posted By:   Anonymous  
Posted On:   Tuesday, April 30, 2002 06:48 AM

For Sun's IMAP provider the fetch() method does indeed fetch the information from the IMAP server.

Note that it only fetches the information specified in the FetchProfile object, hence if you ask for some other information about a message later, JavaMail will have to go back to the IMAP server again to fetch it.

Morten

About | Sitemap | Contact