java - JavaMail Connect over imaps to an e-mail store - extend the timeout -


i'm trying extend timeout connecting e-mail store (microsoft exchange server) not having success. reason being, on local machine connecting store instantaneous on machine i'm deploying code can take couple minutes. rather continually trying connect on , on i'd rather have long timeout. how this? here code (trying set timeout 2 minutes):

        properties properties = new properties();         properties.put("mail.store.protocol", "imaps");         properties.put("mail.imaps.host", iesproperties.store_host);         properties.put("mail.imaps.port", "993");         properties.put("mail.imaps.connectiontimeout", "120000"); // 2 minutes         properties.put("mail.imaps.timeout", "120000"); // 2 minutes          session session = session.getinstance(properties);         imapstore store = null;          try {             store = (imapstore) session.getstore("imaps");             try {                 store.connect(iesproperties.store_username, iesproperties.store_password); 

when run seems give after 10 seconds or that.

jvm 1    | javax.mail.messagingexception: connection timed out: connect; jvm 1    |   nested exception is: jvm 1    |      java.net.connectexception: connection timed out: connect jvm 1    |      @ com.sun.mail.imap.imapstore.protocolconnect(imapstore.java:66 5) jvm 1    |      @ javax.mail.service.connect(service.java:295) jvm 1    |      @ javax.mail.service.connect(service.java:176) jvm 1    |      @ javax.mail.service.connect(service.java:196) jvm 1    |      @ com.axa.ets.ies.main.start(main.java:297) jvm 1    |      @ com.axa.ets.ies.main.main(main.java:232) jvm 1    |      @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) jvm 1    |      @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) jvm 1    |      @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown sourc e) jvm 1    |      @ java.lang.reflect.method.invoke(unknown source) jvm 1    |      @ org.tanukisoftware.wrapper.wrappersimpleapp.run(wrappersimple app.java:325) jvm 1    |      @ java.lang.thread.run(unknown source) 

when telnet store takes long time, connects in minute.

how extend timeout using api? thanks

i´m not sure if can control via code. might possible control via server (see here -> connection time-out limits imap4):

this example sets connection time-out limit idle authenticated connections.

set-imapsettings -identity cas01 -authenticatedconnectiontimeout timevalue 

this example sets connection time-out limit idle unauthenticated connections.

set-imapsettings -identity cas01 -preauthenticatedconnectiontimeout timevalue 

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -