Code for coarse grain and fine grain locking on a circularly doubly linked list, the lock used is the read write lock which employs compare and set mechanism from java