Turn messageID into an AtomicInteger obj
improve locking