Serious javamail problem? socketRead0

Let's imagine such experiment:

1. we have java-program, which receives mail from some POP3 server.

this program simple uses something like this:

....

msgs = folder.getMessages(1,1);

folder.fetch(msgs, fp);

....

2. Let's imagine, that our test POP3 server has bug: in some moment, when our java-mail-client sends him command "RETR" or "TOP", mail-server becomes non-repsonsible, I mean it begins do something, like this:

do{

if (Thread.interrupted())break;

}while (true);

So, the problem is, that in this case our javamail client becomes alsonon-responsible, non-interruptable and so on.

Researches show, that problem is in native java-method: socketRead0 (in class SocketInputStream), which is blocking, non-interruptable method. This method is used by javamail classes for operate with sockets.

[1104 byte] By [Andremona] at [2007-11-27 10:02:44]
# 1

The solution is:

Properties props = new Properties();

props.setProperty("mail.pop3.connectiontimeout", MAIL_CONNECTION_TIMEOUT);

props.setProperty("mail.pop3.timeout", MAIL_CONNECTION_TIMEOUT);

Session pop3Session = javax.mail.Session.getInstance(props);

Andremona at 2007-7-13 0:37:07 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...