spring-projects/spring-integration master branch

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

Build result summary


11 minutes
07a6fb3a9a2215058f39737e7ffffdfdbef69d2f 07a6fb3a9a2215058f39737e7ffffdfdbef69d2f
Total tests
Successful since
#2376 ()


Code commits

Author Commit Message Commit date
Alexander Pinske <alex@pinske.eu> Alexander Pinske <[email protected]> 07a6fb3a9a2215058f39737e7ffffdfdbef69d2f 07a6fb3a9a2215058f39737e7ffffdfdbef69d2f 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`**