我正在开发一个 Web 应用程序,其中我使用 Java 作为前端,使用 shell 脚本作为后端。我需要在 shell 脚本中处理很多文件,假设我需要在 shell 脚本中处理 1000 个文件。我正在使用 Java 中的以下代码
for(i from 1..1000)
{
Call shell script to process file i
}
在 shell 脚本中,我正在做一些处理逻辑并将 o/p 存储在本地文件中(然后可以从 Java 访问)。
My requirement is, for everytime the shell script being called, an output is generated to a file. so as an when the control from shell script to java, I have to process it and display it in the front end. But the for loop should not break. It has to carry on with as it is but some front end work of displaying this file should also take place.
我尝试对此进行搜索,我得到的建议是为此使用 AJAX 和长轮询以及线程。你们能分享一些关于这个的想法吗?谢谢你。