Build: #88 was successful Changes by Alexander Pinske <[email protected]>

Build result summary


10 minutes
c6ecd90abec90810cc0aa2381d6254e8889ebfaa c6ecd90abec90810cc0aa2381d6254e8889ebfaa
Total tests
Successful since
#87 ()


Code commits

Author Commit Message Commit date
Alexander Pinske <> Alexander Pinske <[email protected]> c6ecd90abec90810cc0aa2381d6254e8889ebfaa c6ecd90abec90810cc0aa2381d6254e8889ebfaa Fix IMAP race condition around idle()
`IMAPFolder.idle()` by default keeps idle-ing after each response.
We don't need that, because we want to fetch the new mails immediately (over the same connection).
To make `idle()` not keep on going, we called
`folder.isOpen()` which in most cases makes `idle()` stop by calling `noop()`
internally (to keep the connection alive) which leads to the current
`idle()`-call being canceled.

The problem this commits addresses is that the call to `noop()` only
happens if there were no calls in the last second.
There is a check for that in `com.sun.mail.imap.IMAPFolder.keepConnectionAlive`.
So if a new message appears less then a second after idle started, we will miss it.

This new way interrupts `idle()` more often than before, e.g. when there
is an expunge-message (i.e. a message was deleted), which we don't care about.
But the subsequent `receive()` in IdleTask will simply get no
messages and then turn around and start idle-ing again.

**Cherry-pick to `5.3.x` & `master`**

# Conflicts:
#        spring-integration-mail/src/main/java/org/springframework/integration/mail/
#        spring-integration-mail/src/test/java/org/springframework/integration/mail/