#2 Fixed a readWriteLock deadlock happening in tests on calling ChangelogDB.removeDB() which then calls ReplicationDB.shutdown().
Code is blocked acquiring a writeLock on the dbCloseLock, but a readLock is never unlocked.
Debugging showed that the ChangeNumberIndexDB is holding a cursor on a ReplicationDB, said cursor holds the readLock.
Despite the ChangeNumberIndexer thread being asked to initiateShutdown(), the thread is waiting indefinitely for new changes which will never come.
DirectoryThread.java:
In initiateShutdown(), call interrupt() to ensure the thread will be interrupted if it calls Object.wait() before checking whether it needs to shutdown, or if it is already waiting.