This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I am running Runtime.getRuntime().exec() to run VLC (VideoLan) software within a servlet. The VLC software runs properly. I use it to record a multicast video streaming.
After running this command, the servlet returns to my AJAX call and my webpage loads.
Problem is: Any subsequent HTTP get or post, the server (Apache Tomcat 7) does not respond.
It is only about after 2 minutes, the server responds back to my browser.
Anyone has the same problem with VLC?
Anyone has any suggestions to advice me to investigate further?
There are several traps that one can fall into using Runtime.exec() so you should read the 4 sections of http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html and implement all the recommendations. If this fails to solve the problem then posting the code might help.
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
But I wonder what use running a GUI client like VLC is from a servlet? When the user is remote, the GUI will appear on the server machine. Is that the intention?
When the remote user wants to start recording, I start VLC on the server and start recording the multicast video. Here is my code:
What could be holding up VLC or tomcat that it stopped responding for 2 minutes?
Many thanks.
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
1
posted
0
Perhaps VLC is writing to the std err stream, which you are not consuming. A full buffer would cause VLC to hang.
Also - you are doing this all in the request processing Thread - not a good idea. I would certainly execute all that code in a separate Runnable object using its own Thread.
Alan Blass wrote:
What could be holding up VLC or tomcat that it stopped responding for 2 minutes?
You have the potential for deadlock on both the process stdout and stderr. You really do need to read the 4 sections of the traps article and to implement all the recommendations.. Added to this, your servlet is not thread safe since you have state stored as instance variables.