Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
trunk
-
None
Description
Analysis
- The test has few mocks, but we don’t mock HookConsumer (derived from ShutdownableThread). Hence, the object needs be in line with its usage pattern.
- The ShutdownableThread has a CountdownLatch that is checked during shutdown.
In the test, the HookConsumer was not being started at all. This caused shutdownLatch (of type CountdownLatch) not to decrement, since no work was performed, but anticipating work is going to be done. The test thus ended up not getting completed, since the thread was in perpetual wait.
Solution
The HookConsumer should be used such that it is started and shutdown. So the test passes.
HookConsumer should check for shouldRun in shutdown method, so that the case where shutdown is called without start is handled.