throw new GoalFailureException(null, e);
public void printStackTrace() { Thread.dumpStack(); super.printStackTrace(); } }
public void body() { TestReport report = new TestReport("test_inline", "Dispatch a goal handled by the inline plan"); try { IGoal agoal = createGoal("testgoal"); dispatchSubgoalAndWait(agoal); report.setSucceeded(true); } catch(GoalFailureException gfe) { report.setReason(gfe.toString()); } getBeliefbase().getBeliefSet("testcap.reports").addFact(report); } }
report.setReason(gfe.toString());
/** * Dispatch a new top-level goal. * @param goal The new goal. */ public void dispatchSubgoalAndWait(IGoal goal, long timeout) { checkNotInAtomic(); dispatchSubgoal(goal); RGoal rgoal = (RGoal)goal; Future<Void> ret = new Future<Void>(); rgoal.addListener(new DelegationResultListener<Void>(ret)); try { ret.get(timeout); } catch(BDIFailureException e) { throw e; } catch(TimeoutException e) { throw e; } catch(Exception e) { throw new GoalFailureException(null, e); } }
/** * Destroy the agents. */ protected void destroyAgents() { if(agents==null) throw new RuntimeException("Destroy agents is intended to be " + "called only when agents have been created"); for(int i=0; i<agents.size(); i++) { // System.out.println("Killing " + ((IComponentIdentifier)agents.get(i)).getName()); try { IComponentManagementService ces = (IComponentManagementService)SServiceProvider.getLocalService(getAgent(), IComponentManagementService.class, RequiredServiceInfo.SCOPE_PLATFORM); IFuture<Map<String, Object>> ret = ces.destroyComponent((IComponentIdentifier)agents.get(i)); ret.get(); } catch(GoalFailureException e) { e.printStackTrace(); getLogger().severe("Exception while destroying agent: "+agents.get(i)); } // System.out.println("Killed " + ((IComponentIdentifier)agents.get(i)).getName()); } agents = null; }
setException(new GoalFailureException("No more candidates: "+this)); setException(new GoalFailureException("No more candidates: "+this));
/** * The plan body. */ public void body() { IComponentManagementService cms = getAgent().getComponentFeature(IRequiredServicesFeature.class) .searchService(IComponentManagementService.class, RequiredServiceInfo.SCOPE_PLATFORM).get(); try { cms.destroyComponent(getComponentIdentifier().getRoot()).get(); System.out.println("Remote platform successfully shutdowned."); } catch(GoalFailureException e) { e.printStackTrace(); } }
setException(new GoalFailureException("No candidates.")); setException(new GoalFailureException("No candidates."));
gfe.printStackTrace(); getLogger().warning("Request vision failed: "+gfe);
setException(new GoalFailureException());