OPENDJ-1130 (CR-2323) Connect Error when stopping all the servers from a replication topology at the same time
Properly marked the state of the thread + checked it from the deeper DbHandler.trim() to ensure the thread stops as fast as possible. DB reentrant locsk then ensure the threads properly wait on each other before shutdown.
DirectoryThread.java:
Added ThreadState enum + a threadState AtomicReference instance field.
Added isShutdownInitiated(), initiateShutdown(), startWork(), stopWork(), setThreadStateIfNotShuttingDown(), getThreadState().
Converted comments to javadocs.
In uncaughtException(), do not log ThreadDeath error (coming from Ludo, suggested as part of OPENDJ-1061).
DbHandler.java:
Removed shutdown and done instance fields (replaced by the DirectoryThread.threadState). The done instance field had an ill defined purpose and its usefulness was questionable.
In shutdown(), used DirectoryThread thread state management methods + removed dead code.
In run() and trim(), used DirectoryThread thread state management methods.