diff --git a/src/java/davmail/ldap/LdapConnection.java b/src/java/davmail/ldap/LdapConnection.java index 664ddcb7..13d2d97e 100644 --- a/src/java/davmail/ldap/LdapConnection.java +++ b/src/java/davmail/ldap/LdapConnection.java @@ -583,6 +583,13 @@ public class LdapConnection extends AbstractConnection { DavGatewayTray.debug(new BundleMessage("LOG_EXCEPTION_SENDING_ERROR_TO_CLIENT"), e2); } throw e; + } finally { + // cancel all search threads + synchronized (searchThreadMap) { + for (SearchRunnable searchRunnable:searchThreadMap.values()) { + searchRunnable.abandon(); + } + } } }