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