ReentrantLock, ReentrantReadWriteLock
RentrantLock is almost the same as synchronized keyword. Only difference is that synchrnozied keyword needs a block. It maintains a queue for the threads. RentrantLock lock = new ReentrantLock(); lock.lock(); try { do something.. } finally { lock.release(); } ReentrantReadWriteLock. It also maintains a queue for threads. When it has queue: [readThread1, readThread2, writeThread3, readThread4]… Read More »