Ravi, A small typo sneaked to the code snippet - the lock() call was omitted - it should be like this (I also omitting the try-finally block for the simplicity)
IgniteCache cache = ...; Lock lock = cache.lock(key); lock.lock(); // ... process while lock is held lock.unlock();
