/** * Get the step number when endstate began. * @return The step cnt. */ public int getEndstateStart() { return ((IInternalExecutionFeature)getComponentFeature(IExecutionFeature.class)).getEndstateStart(); }
.block(this, timeout, realtime);
/** * Shared cleanup code for shutdown and kill. */ protected void doCleanup(Error e) { // System.out.println("shutdown end: "+getComponent().getComponentIdentifier()); // Should not wake up all blocked threads at the same time?! // Could theoretically catch the threaddeath and do sth what is not guarded against concurrent access // if(blocked!=null && blocked.size()>0) // System.out.println("blocked: "+blocked.size()); while(blocked!=null && !blocked.isEmpty()) { // Unblock throwing thread death as component already has been terminated. unblock(blocked.keySet().iterator().next(), e); // unblock(blocked.keySet().iterator().next(), null); } // if(parenta!=null) { parenta.removeSubcomponent(ExecutionComponentFeature.this); } }
parenta.addSubcomponent(this); parenta.wakeup();
((IInternalExecutionFeature)adapter.getInternalAccess().getComponentFeature(IExecutionFeature.class)).wakeup();
int endstart = ((IInternalExecutionFeature)getComponent().getComponentFeature(IExecutionFeature.class)).getEndstateStart(); boolean stateok = priostep || endstart==-1 || step.getStepCount()>=endstart; boolean again = ((IInternalExecutionFeature)sub).execute(); this.componentthread = null; if(again)
/** * Unblock the thread waiting for the given monitor * and cease execution on the current thread. * @param monitor The monitor to notify. */ public void unblock(Object monitor, Throwable exception) { if(!isComponentThread()) { throw new RuntimeException("Can only unblock from component thread: "+componentthread+", "+Thread.currentThread()); } if(parenta!=null) { parenta.unblock(monitor, exception); } else { // System.out.println("unblock: "+monitor); Executor exe = blocked.remove(monitor); if(blocked.isEmpty()) { blocked = null; } exe.switchThread(monitor, exception); } }
((IInternalExecutionFeature)adapter.getComponentFeature(IExecutionFeature.class)).doStep(stepinfo) .addResultListener(agent.getComponentFeature(IExecutionFeature.class).createResultListener(new DelegationResultListener<Void>(ret)));
((IInternalExecutionFeature)getComponent().getComponentFeature(IExecutionFeature.class)).wakeup();
public IFuture<Void> execute(IInternalAccess ia) { // System.out.println("ComponentSuspendable.resume2 "+Thread.currentThread()); synchronized(ComponentSuspendable.this) { // System.out.println("ComponentSuspendable.resume3 "+Thread.currentThread()); // Only wake up if still waiting for same future (invalid resume might be called from outdated future after timeout already occurred). if(future==ComponentSuspendable.this.future) { // System.out.println("ComponentSuspendable.resume4 "+Thread.currentThread()); beforeSwitch(); ((IInternalExecutionFeature)agent.getComponentFeature(IExecutionFeature.class)) .unblock(ComponentSuspendable.this, null); } } return IFuture.DONE; } });
.unblock(this, null);
parenta.block(monitor, timeout, realtime);