Message count update logic improved

- Removed unwanted synchronisations
- Count update logic improved to avoid unexpected behaviour in multi threaded environment
- Message count update logic moved to a separate class, MessageCountFlusher
Merge pull request #217 from Asitha/message-counter

Message count update logic improved