且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Java中检查线程是否已经启动?

更新时间:2023-11-28 07:52:09

您可以使用 Thread.getState()并使用相应的状态

You can use Thread.getState() and use the corresponding states.

请注意,当您阅读此状态时,它可能已更改,但您可以确定感兴趣的内容。查看此状态图了解可用的转换。

Note that by the time you read this state it may have changed, but you may be able to determine something of interest. Check out this state diagram for the available transitions.