Android : android : Timeoutexception while waiting for mails using Javamails

on Wednesday, August 6, 2014


I am using Javamail apis to read gmail / yahoo in my app. I have a timertask which which spwans threads to fetch mails periodically. It is working fine for gmail. For Yahoo i am getting a timeout exception as below.



java.util.concurrent.TimeoutException: com.sun.mail.imap.IMAPSSLStore.finalize() timed out after 15 seconds
at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_read(Native Method)
at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:686)
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:124)
at java.io.InputStream.read(InputStream.java:163)
at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:142)
at java.io.BufferedInputStream.read(BufferedInputStream.java:227)
at com.sun.mail.iap.ResponseInputStream.readResponse(ResponseInputStream.java:96)
at com.sun.mail.iap.Response.<init>(Response.java:95)
at com.sun.mail.imap.protocol.IMAPResponse.<init>(IMAPResponse.java:60)
at com.sun.mail.imap.protocol.IMAPProtocol.readResponse(IMAPProtocol.java:280)
at com.sun.mail.iap.Protocol.command(Protocol.java:313)
at com.sun.mail.imap.protocol.IMAPProtocol.examine(IMAPProtocol.java:864)
at com.sun.mail.imap.IMAPFolder.close(IMAPFolder.java:1329)
at com.sun.mail.imap.IMAPFolder.close(IMAPFolder.java:1263)
at com.sun.mail.imap.IMAPStore.cleanup(IMAPStore.java:1494)
at com.sun.mail.imap.IMAPStore.close(IMAPStore.java:1387)
at com.sun.mail.imap.IMAPStore.finalize(IMAPStore.java:1428)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:188)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:171)
at java.lang.Thread.run(Thread.java:841)


I didnt get the logic why it is happening. What i could see is that yahoo is taking relatively more time to respond than gmail. But i am not clear how this delay is resulting in calling finalizedaemon. Can anyone explain whats could be actually happening and is there a way to solve this issue


0 comments:

Post a Comment