我使用 spring 2.5 JavaMailSenderImpl 发送邮件。当我发送超过 10,000 封邮件时,我的程序被阻止了。这是 jstack 显示的线程信息:
"pool-4-thread-6" prio=10 tid=0x000000001b94d800 nid=0x44fb runnable [0x0000000041901000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:150)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:97)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
- **locked** <0x00000000e6e2d170> (a java.io.BufferedInputStream)
at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:75)
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1440)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1260)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:275)
at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.ja
va:389)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java
:342)
at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java
:338)
也许这个程序因为邮件连接而被阻止,但我在 spring 配置文件中部署了 out-time:
<property name ="javaMailProperties">
<props>
<prop key="mail.smtp.connectiontimeout">25000</prop>
<prop key="mail.smtp.timeout">25000</prop>
</props>
</property >
程序应该在时间超过时抛出异常。但它仍然被阻塞!有谁知道原因吗?