Description
I saw an exception happen today that turned out to be improper use of Reentrant locks. Acquiring the lock should always be done before the try block so that the finally clause to unlock will never execute unless the lock is acquired. More info: https://stackoverflow.com/questions/31058681/java-locking-structure-best-pattern
The issue is inside of AbstractRuntimeConfigurationBroker, for example: https://github.com/apache/activemq/blob/d8ce1d9ff0fa2296f3c56b59602e5cddb6ffe4a9/activemq-runtime-config/src/main/java/org/apache/activemq/plugin/AbstractRuntimeConfigurationBroker.java#L81
I saw a IllegalMonitorStateException exception occur due to lockInterruptibly() throwing an exception so when the finally block tried to unlock it threw the IllegalMonitorStateException since it was not owned by the thread.
I went through the rest of the code and most places are correct but a couple spots need to be fixed as well.