Previously there was a concurrency race condition, where
`parameters` with `idCache` for poll Messages query had one state on building phase,
but had another one on execution phase.
* Introduce `ReentrantReadWriteLock` `idCacheLock` for operation around `idCache`
* Change `idCache` to simple `HashSet`, because thread-safety is guaranteed by `idCacheLock`
* Add a concurrency test-case, which failed before fix
JIRA: https://jira.springsource.org/browse/INT-2993