public void timeEventOccurred(final long currenttime) { try { scheduleStep(new ExecuteWaitForStep(ts[0], run)); } catch(ComponentTerminatedException e) { } } });
/** * Helper method to override message handling. * May be called from external threads. */ protected IComponentStep<Void> createHandleMessageStep(IMessageAdapter message) { return new HandleMessageStep(message); }
/** * Extracted to allow overriding behaviour. * @return true, when at least one matching handler was found. */ protected boolean invokeHandlers(IConnection con) { // todo: create bdi reasoning event return super.invokeHandlers(con); } }
public IFuture<Void> execute(IInternalAccess ia) { invokeHandlers(message); return IFuture.DONE; }
/** * Compare two steps. */ public int compareTo(StepInfo o) { int ret = o.getPriority()-getPriority(); if(ret==0) ret = getStepCount()-o.getStepCount(); return ret; }
/** * Get the current state as events. */ public List<IMonitoringEvent> getCurrentStateEvents() { List<IMonitoringEvent> ret = null; IExecutionFeature exef = getComponent().getComponentFeature0(IExecutionFeature.class); if(exef instanceof ExecutionComponentFeature) ret = ((ExecutionComponentFeature)exef).getCurrentStateEvents(); return ret; } }
public void resultAvailable(T result) { cnt++; check(); }
/** * Wait for some time and execute a component step afterwards. */ public <T> IFuture<T> waitForDelay(final long delay, final IComponentStep<T> step) { return waitForDelay(delay, step, false); }
/** * Shutdown the feature. */ public IFuture<Void> shutdown() { doCleanup(); return IFuture.DONE; }
/** * Execute a component step. */ public <T> IFuture<T> scheduleStep(IComponentStep<T> step) { return scheduleStep(IExecutionFeature.STEP_PRIORITY_NOMRAL, step); }
/** * Repeats a ComponentStep periodically, until terminate() is called on result future or a failure occurs in a step. * @param initialDelay delay before first execution in milliseconds * @param delay delay between scheduled executions of the step in milliseconds * @param step The component step * @return The intermediate results */ @Override public <T> ISubscriptionIntermediateFuture<T> repeatStep(long initialDelay, long delay, IComponentStep<T> step) { return repeatStep(initialDelay, delay, step, false); }
/** * Helper method to override stream handling. * May be called from external threads. */ protected IComponentStep<Void> createHandleStreamStep(IConnection con) { return new HandleStreamStep(con); }
/** * Create an instance of the feature. */ public IComponentFeature createInstance(IInternalAccess access, ComponentCreationInfo info) { return new ExecutionComponentFeature(access, info); }
protected void entryChanged(String key, Object oldvalue, Object newvalue) { postEvent(key, newvalue); } };
/** * Send a message. * @param me The message content (name value pairs). * @param mt The message type describing the content. */ public IFuture<Void> sendMessage(Map<String, Object> me, MessageType mt) { return sendMessage(me, mt, null); }
public IFuture<Void> execute(IInternalAccess ia) { invokeHandlers(con); return IFuture.DONE; }
public void exceptionOccurred(Exception exception) { cnt++; check(); }
/** * Wait for some time. */ public IFuture<Void> waitForDelay(final long delay) { return waitForDelay(delay, false); }
/** * Kill is only invoked, when shutdown of some (e.g. other) feature does not return due to timeout. * The feature should do any kind of possible cleanup, but no asynchronous operations. */ public void kill() { doCleanup(); }
public void setMax(int max) { this.max = max; check(); } };