-
1. Re: Spawning processes from JBoss App Server
genman Aug 7, 2007 5:53 PM (in response to dilip_anant)No, not by default.
You might want to post your code. My advice is to come up with a baseline implementation that works (perhaps just calls "ping 127.0.0.1") then develop the code into the more complex commands you need to run. -
2. Re: Spawning processes from JBoss App Server
dilip_anant Aug 17, 2007 3:21 AM (in response to dilip_anant)This is the code snippet that does the job:
Runtime r = Runtime.getRuntime();
serverIPOrHostName = (String) bfuParameters.get(SERVERIP_HOSTNAME);
service = (String) bfuParameters.get(SERVICE_NAME);
String cmd = SERVICECHECK + SYMBOL + serverIPOrHostName + QUERY + service;
p = r.exec(cmd);
inp = p.getInputStream();
byte[] dataInput = new byte[320];
inp.read(dataInput);
String inputData = new String(dataInput);
//Logger added to read the service response.
logger.error(inputData);
//Checks for specified sequence of characters in the string and
//returns boolean.
if (inputData.contains(SERVICE_RUNNING)) {
result = 1;
} else {
result = 0;
}