* executing this method is interrupted.
* @throws StaleProxyException if the method was not able to execute the Command
* @see jade.wrapper.AgentController#putO2AObject(Object, boolean)
**/
public final void execute(Object command, long timeout) throws StaleProxyException,ControllerException,InterruptedException {
Event e = null;
synchronized (this) {
checkJADE();
// incapsulate the command into an Event
e = new Event(-1, command);
try {
if (myLogger.isLoggable(Logger.INFO))
myLogger.log(Logger.INFO, "Requesting execution of command "+command);
myAgent.putO2AObject(e, AgentController.ASYNC);
} catch (StaleProxyException exc) {
exc.printStackTrace();
// in case an exception was thrown, restart JADE
// and then reexecute the command
restartJADE();
myAgent.putO2AObject(e, AgentController.ASYNC);
}
}
// wait until the answer is ready
e.waitUntilProcessed(timeout);
}