acquireReadLock

takeWriteLock

Takes the exclusive write lock. Once started, no other thread lock the read or write lock. When this method returns,
this thread will have locked the write lock and no other thread will have either the read or write lock.
Note that this thread must first drop the read lock (if it has it) before attempting to take the write lock, or this method will block forever.

releaseWriteLock

upgradeReadLockToWriteLock

Releases the read lock, then takes the write lock. There's a short window where the thread will have neither lock:
during that window, some other thread may have a chance to take the write lock. In code, you'll often see a second check
inside the code that has the write lock to see if the update to perform is still necessary.