@Test(timeout=10000) public void testNoWaitIfAgentHalts() throws Exception { this.agent.getProductions().loadProduction("test (state <s> ^superstate nil) --> (wait) (halt)"); assertFalse(this.agent.getProperties().get(SoarProperties.WAIT_INFO).waiting); final AtomicBoolean signalled = new AtomicBoolean(false); final Object signal = new String("testNoWaitIfAgentHalts"); agent.execute(new Callable<Void>() { @Override public Void call() throws Exception { agent.runForever(); return null; }}, new CompletionHandler<Void>(){ @Override public void finish(Void result) { synchronized(signal) { signal.notifyAll(); signalled.set(true); } }}); if(!signalled.get()) { synchronized(signal) { signal.wait(); } } }
@Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); RhsFunctions.checkAllArgumentsAreNumeric(getName(), arguments); final long timeout = arguments.isEmpty() ? Long.MAX_VALUE : arguments.get(0).asInteger().getValue(); waitManager.requestWait(new WaitInfo(timeout, context.getProductionBeingFired())); return null; }
WaitRhsFunction extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); RhsFunctions.checkAllArgumentsAreNumeric(getName(), arguments); final long timeout = arguments.isEmpty() ? Long.MAX_VALUE : arguments.get(0).asInteger().getValue(); waitManager.requestWait(new WaitInfo(timeout, context.getProductionBeingFired())); return null; } }
WaitRhsFunction extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); RhsFunctions.checkAllArgumentsAreNumeric(getName(), arguments); final long timeout = arguments.isEmpty() ? Long.MAX_VALUE : arguments.get(0).asInteger().getValue(); waitManager.requestWait(new WaitInfo(timeout, context.getProductionBeingFired())); return null; } WaitRhsFunction(); }
WaitRhsFunction extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); RhsFunctions.checkAllArgumentsAreNumeric(getName(), arguments); final long timeout = arguments.isEmpty() ? Long.MAX_VALUE : arguments.get(0).asInteger().getValue(); waitManager.requestWait(new WaitInfo(timeout, context.getProductionBeingFired())); return null; } WaitRhsFunction(); void attach(WaitManager waitManager); void detach(); @Override Symbol execute(RhsFunctionContext context, List<Symbol> arguments); @Override boolean mayBeStandalone(); }
WaitRhsFunction extends AbstractRhsFunctionHandler { @Override public Symbol execute(RhsFunctionContext context, List<Symbol> arguments) throws RhsFunctionException { RhsFunctions.checkArgumentCount(this, arguments); RhsFunctions.checkAllArgumentsAreNumeric(getName(), arguments); final long timeout = arguments.isEmpty() ? Long.MAX_VALUE : arguments.get(0).asInteger().getValue(); waitManager.requestWait(new WaitInfo(timeout, context.getProductionBeingFired())); return null; } WaitRhsFunction(); void attach(WaitManager waitManager); void detach(); @Override Symbol execute(RhsFunctionContext context, List<Symbol> arguments); @Override boolean mayBeStandalone();  }