如何让 SwingWorker 等待从此 SwingWorker 内部启动的线程
我对 SwingWorker
及其 done()
方法有问题。我有一个通过 SPI 支持插件的应用程序,所以我基本上无法更改插件的行为。这些插件必须实现的接口包含方法 List
SwingWorker
的 doInBackground()
方法调用的方法。但有些插件在此 getContracts()
方法中使用多个线程。问题是,在这些线程完成之前,会调用 done()
方法。有没有办法让 SwingWorker
线程不完成(不调用它的 done()
方法),直到从此 SwingWorker
调用所有线程停止?
感谢您的帮助。
I have problem with SwingWorker
and it's done()
method. I have an application that supports plugins through SPI, so I basically can't change the behavior of the plugins. The interface these plugins have to implement contains method List<T> getContracts()
. This is the method I am calling from SwingWorker
's doInBackground()
method. But some of the plugins use multiple threads in this getContracts()
method. The problem is, that the done()
method is then called before these threads finish. Is there a way to make SwingWorker
thread not to finish (not to call it's done()
method) until all the threads called from this SwingWorker
stop?
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来您应该将这个问题包装在你的 SwingWorker did() 方法。
It seems you should just be wrapping this question in your SwingWorker done() method.