Gardner Vickers created KAFKA-7956:
--------------------------------------
Summary: Avoid blocking in ShutdownableThread.awaitShutdown if the
thread has not been started
Key: KAFKA-7956
URL: https://issues.apache.org/jira/browse/KAFKA-7956
Project: Kafka
Issue Type: Improvement
Components: core
Reporter: Gardner Vickers
Opening this Jira to track [https://github.com/apache/kafka/pull/6218], since
it's a rather subtle change.
In some test cases it's desirable to instantiate a subclass of
`ShutdownableThread` without starting it. Since most subclasses of
`ShutdownableThread` put cleanup logic in `ShutdownableThread.shutdown()`,
being able to call `shutdown()` on the non-running thread would be useful.
This change allows us to avoid blocking in `ShutdownableThread.shutdown()` if
the thread's `run()` method has not been called. We also add a check that
`initiateShutdown()` was called before `awaitShutdown()`, to protect against
the case where a user calls `awaitShutdown()` before the thread has been
started, and unexpectedly is not blocked on the thread shutting down.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)