I have a multi-threaded program where I have created a ReadWriteLock instance with fair value true. This application has stopped responding.
Below are our findings based on the thread dump. One thread acquired the read lock and it blocked at the DB operation during the execution. It did not release the lock for a long time.
There are three more threads other than the above thread. One thread is waiting to acquire write lock. Whereas, two other threads are waiting to acquire read lock.
Question is that why two threads are waiting for read lock? Is it happening because fair value is true and the thread requesting for write lock came earlier than the two threads requesting for read lock? Will system block the threads requesting for read locks if thread requesting for write came earlier?