Removed spin lock and exchanged it with CountDownLatch for MapReduce

fixed issue #1648