0

I am developing a web application, wherein I am using Java as my front end and shell script as my back end. I need to process lot of files in shell script, let me assume that I need to process 1000 files in shell script. I am using the following code from Java

for(i from 1..1000)
{
       Call shell script to process file i
}

Intenally in the shell script, I am doing some processing logic and storing the o/p in a local file(which can then be accessed from 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.

I tried searching about this and the recommendations that I got is to use AJAX and long polling for this and also threading. Could you people share some ideas regarding this. Thank you.

NandaKumar
  • 905
  • 4
  • 15
  • 19

1 Answers1

0

This can also be done with websockets. For instance, you can send back info per each of the 100. Also google "Comet" or "Reverse Ajax" (especially for older browser support).

Really, you probably want to look at something called Socket.Io or the corresponding frameworks for other languages/environments.

Nowadays, a lot of users are running HTML 5 browsers with web socket support, so depending on the audience you don't have to worry about opening up long polling connections.

David
  • 2,715
  • 2
  • 22
  • 31