如何查找线程最初启动的位置 [英] How to find where a thread was originally started
问题描述
我的问题是,如果我暂停此线程异步任务使用eclipse IDE(调试透视图)有没有办法找出这个线程最初启动的位置例如使用Debug视图或任何其他)?因为我想知道谁生产这个线程(没有进行文本搜索或这样的东西)。
有没有一个很好的方式来获取这些信息?
我将在 Thread.start()
中设置断点,并启用条件
每当一个名为异步任务的线程启动时,条件都将被计算为true,调用start方法的线程将被暂停。然后你可以看到stacktrace从哪里来电。
Supposed I have an application that can spawn multiple threads if needed for doing tasks ... so nothing special. I use Eclipse to write and debug Java applications. A thread (lets call it "async task") is immediatly respawned after it leaves the run() method (so there is bug and I want to find the reason for this behavior).
My question, if I pause this thread "async task" using the eclipse IDE (debug perspective ..) is there way to find out where this thread was originally started (for example using the Debug view or any other)? Because I want to know who spawns this thread (without making a text search or something like this).
Is there a good way to get this information?
I would set a breakpoint at Thread.start()
and enable a condition
Whenever a thread named "async task" is started the condition is evaluated to true and the thread that invokes the start method is paused. Then you can see in the stacktrace from where the call came.
这篇关于如何查找线程最初启动的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!