目标
我想在ThreadPoolExecutor的源代码中找到特定的代码行。
当任务提交给ThreadPoolExecutor时,如果池中的所有其他线程都忙,则会创建一个线程。有人可以带我到ThreadPoolExecutor的源代码中的那些代码行,在那里检查池中的所有其他线程是否忙,如果忙,则在空闲时创建新线程,然后将任务切换到空闲线程?
答案 0 :(得分:0)
源代码可在OpenJDK mercurial repository中找到。您感兴趣的位置似乎位于execute()
方法中,位于:
您可能最好在正确配置的IDE中打开它,这样您就可以更轻松地在源代码中导航。