Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个任务,我必须使用不同的线程读取数据。
问题是由于读取速率的限制,我用线程组构建了不同的线程。
现在谁能告诉我如何让整个线程组休眠,以便它从它离开的完全相同的位置开始执行,而其他线程组继续执行?
如果没有更多细节,听起来您可能需要考虑使用 CyclicBarrier 或 CountDownLatch。它们不会在 ThreadGroup 级别运行,但可能会提供您正在寻找的公共等待点。