[
https://issues.apache.org/jira/browse/KAFKA-7956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16778410#comment-16778410
]
ASF GitHub Bot commented on KAFKA-7956:
---------------------------------------
junrao commented on pull request #6218: KAFKA-7956 In ShutdownableThread,
immediately complete the shutdown if the thread has not been started
URL: https://github.com/apache/kafka/pull/6218
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org
> 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
> Priority: Minor
>
> 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)