Cancel empty pool on close

pull/207/head
M66B 2 years ago
parent 3cc9856daf
commit 0f01041b87

@ -1459,6 +1459,28 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
}
});
final Runnable purge = new RunnableEx("purge") {
@Override
public void delegate() {
executor.submit(new RunnableEx("purge#exec") {
@Override
public void delegate() {
try {
wlAccount.acquire();
// Close cached connections
Log.i(account.name + " Empty connection pool");
((IMAPStore) iservice.getStore()).emptyConnectionPool(false);
} catch (Throwable ex) {
Log.e(ex);
} finally {
wlAccount.release();
}
}
});
}
};
final Map<EntityFolder, IMAPFolder> mapFolders = new LinkedHashMap<>();
List<Thread> idlers = new ArrayList<>();
try {
@ -1834,28 +1856,6 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
forced = true;
final Runnable purge = new RunnableEx("purge") {
@Override
public void delegate() {
executor.submit(new RunnableEx("purge#exec") {
@Override
public void delegate() {
try {
wlAccount.acquire();
// Close cached connections
Log.i(account.name + " Empty connection pool");
((IMAPStore) istore).emptyConnectionPool(false);
} catch (Throwable ex) {
Log.e(ex);
} finally {
wlAccount.release();
}
}
});
}
};
final long serial = state.getSerial();
Log.i(account.name + " observing operations");
@ -2314,6 +2314,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
EntityLog.log(this, EntityLog.Type.Account, account,
account.name + " closing");
getMainHandler().removeCallbacks(purge);
// Stop watching operations
Log.i(account.name + " stop watching operations");
final TwoStateOwner _owner = cowner.value;

Loading…
Cancel
Save