java进程和输入流
我正在为 eclipse 开发一个插件,其中进程正在运行。我创建了一个进程,在读取其输入流后,但是当进程和输入流正在运行时,我的 eclipse 平台无法回答任何问题。所以我想做一个解决方案,当日食不冻结时。我想我应该用java线程来做到这一点。
如果有人有想法,请描述一下。谢谢!
I'm developing a plugin for eclipse, in which process are running. I create a process and after I read its inputsream, but while the process and the inputstream are running, my eclipse platform can't answer for anything. So I would like to do a solution, when eclipse doesn't freeze. I think I should do this with java threads.
If somebody has an idea, describe that please. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以生成一个单独的线程来读取输入流。
要查看此示例,请在 Eclipse 中执行 File ->导入->插件开发->插件和片段。从活动平台导入,并导入带有源文件夹的项目。在下一个选项卡上,选择“org.eclipse.equinox.p2.jarprocessor”。
查看 org.eclipse.equinox.internal.p2.jarprocessor.StreamProcessor。它以两种模式运行,一种使用作业,另一种使用普通线程。查看 CommandStep#execute 中使用的 StreamProcessor
You can spawn a separate thread to read the input stream.
To see an example of this, in Eclipse, do File -> Import -> Plug-in Development -> Plug-ins and Fragments. Import from the active platform, and import projects with source folders. On the next tab, choose "org.eclipse.equinox.p2.jarprocessor".
Take a look at org.eclipse.equinox.internal.p2.jarprocessor.StreamProcessor. It runs in two modes, one using Jobs, the other using normal threads. See the StreamProcessor getting used in CommandStep#execute