Added JavaMail idle failsafe

pull/184/head
M66B 5 years ago
parent c4f9d1584e
commit a0a8763047

@ -1185,7 +1185,11 @@ public class IMAPStore extends Store
// someone else is using the connection, give up // someone else is using the connection, give up
// and wait until they're done // and wait until they're done
p = null; p = null;
pool.wait(); pool.wait(pool.clientTimeoutInterval);
if (pool.storeConnectionInUse) {
eu.faircode.email.Log.e("getStoreProtocol timeout");
throw new InterruptedException("getStoreProtocol timeout");
}
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
// restore the interrupted state, which callers might // restore the interrupted state, which callers might
// depend on // depend on
@ -2069,7 +2073,11 @@ public class IMAPStore extends Store
// without aborting it ourselves // without aborting it ourselves
try { try {
// give up lock and wait to be not idle // give up lock and wait to be not idle
pool.wait(); pool.wait(pool.clientTimeoutInterval);
if (pool.idleState != ConnectionPool.RUNNING) {
eu.faircode.email.Log.e("idle timeout");
throw new InterruptedException("idle timeout");
}
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
// restore the interrupted state, which callers might // restore the interrupted state, which callers might
// depend on // depend on
@ -2162,7 +2170,11 @@ public class IMAPStore extends Store
} }
try { try {
// give up lock and wait to be not idle // give up lock and wait to be not idle
pool.wait(); pool.wait(pool.clientTimeoutInterval);
if (pool.idleState != ConnectionPool.RUNNING) {
eu.faircode.email.Log.e("waitIfIdle timeout");
throw new InterruptedException("waitIfIdle timeout");
}
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
// If someone is trying to interrupt us we can't keep going // If someone is trying to interrupt us we can't keep going
// around the loop waiting for IDLE to complete, but we can't // around the loop waiting for IDLE to complete, but we can't

Loading…
Cancel
Save