【发布时间】:2011-10-21 11:44:23
【问题描述】:
我有 2 个班级,fe Class1 和 Class2
假设我在 Class1 中这样做:
Class2 class2 = new Class2();
Thread thread = new Thread(class2);
thread.start();
...
thread.stop();
现在我想在我的线程停止时检查 Class2 的 run 方法,我该怎么做? 所以当class1停止线程时,我想提醒class2它停止了,然后做一些事情
【问题讨论】:
-
您阅读过
Thread.stop的 API 文档吗?他们是认真的。 -
在你停止线程后调用class2的一个方法:thread.stop(); class2.doSomething();
标签: java multithreading