1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 03:02:22 -05:00

Serialize session creation in workstation mode to avoid multiple OTP requests

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1664 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2011-04-12 21:30:52 +00:00
parent 184ba21cf0
commit 31214b1be2

View File

@ -84,9 +84,20 @@ public final class ExchangeSessionFactory {
* @throws IOException on error
*/
public static ExchangeSession getInstance(String userName, String password) throws IOException {
String baseUrl = Settings.getProperty("davmail.url");
if (Settings.getBooleanProperty("davmail.server")) {
return getInstance(baseUrl, userName, password);
} else {
// serialize session creation in workstation mode to avoid multiple OTP requests
synchronized (LOCK) {
return getInstance(baseUrl, userName, password);
}
}
}
public static ExchangeSession getInstance(String baseUrl, String userName, String password) throws IOException {
ExchangeSession session = null;
try {
String baseUrl = Settings.getProperty("davmail.url");
// prepend default windows domain prefix
String defaultDomain = Settings.getProperty("davmail.defaultDomain");