/* default timeout is 10 mins */
return callTimeoutInSec(method, params, 600, debug);
}
public Object callTimeoutInSec(String method, Object[] params, int timeout, boolean debug) throws XmlRpcException {
TimingOutCallback callback = new TimingOutCallback(timeout * 1000);
Object[] mParams = new Object[params.length + 1];
mParams[0] = method;
for (int i = 0; i < params.length; i++) {
mParams[i + 1] = params[i];
}
if (debug) {
/*
* some parameters including user password should not be printed in log
*/
s_logger.debug("Call Ovm agent: " + Coder.toJson(mParams));
}
long startTime = System.currentTimeMillis();
_client.executeAsync("OvmDispatch", mParams, callback);
try {
return callback.waitForResponse();
} catch (TimingOutCallback.TimeoutException to) {
throw to;
} catch (Throwable e) {
throw new XmlRpcException(-2, e.getMessage());
} finally {