-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrei,

On 11/21/12 4:42 AM, Andrei Petru Mura wrote:
> TheProcessing.logoutSubscriberByMac(mac) has that code on it:
> 
> public static void logoutSubscriberByMac(String mac) { try {
> 
> Process proc = Runtime.getRuntime().exec("logout subscriber 
> command"); proc.waitFor(); //here is the problem

You almost certainly have a problem with stream management: if you
don't drain both the output stream and error stream of the process,
then your code can hang. Likewise, if you don't close the standard
input stream to the process, the child process may block waiting for
input.

It sounds silly, even if you use little or no standard input or output
from your child process, but failure to manage these streams can and
will hang up your Java code.

You can either write multi-threaded code to handle all these streams,
or you can use one of the several high-quality utility libraries out
there that can wrap Runtime.exec for you and take care of this kind of
stuff.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlCvwUoACgkQ9CaO5/Lv0PCbcACfXgar8R/7jGDrV6Bjgd0FbXEM
OBcAn2aPFGndEjUmdOynJsjHbJF2RaqD
=QFpl
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to