Use LockModeType.PESSIMISTIC_WRITE for locking semaphore resource