/** * A shortcut for dispatching a goal as subgoal of the active goal * and waiting for the subgoal to be finished. * Additionally the subgoal will be dropped when finished. * This differs from the dispatchSubgoal implementation. * @param subgoal The new subgoal. * @param timeout The timeout. * @throws GoalFailureException when the goal fails. */ public void dispatchSubgoalAndWait(IGoal subgoal, long timeout) { dispatchSubgoal(subgoal); // Todo: check thread access. Object wa = getState().createObject(OAVBDIRuntimeModel.waitabstraction_type); SFlyweightFunctionality.addGoal(wa, (ElementFlyweight)subgoal, getState(), getRCapability()); PlanRules.waitForWaitAbstraction(wa, timeout, getState(), getRCapability(), getRPlan()); }