/** * provides the un-threaded super fire-method. see {@link EventController#fireEvent(Object)} * * @param e new event */ public void sendEvent(final Object e) { super.fireEvent(e); } }
/** * provides the un-threaded super fire-method. see {@link EventController#fireEvent(Object)} * * @param e new event */ public void sendEvent(final Object e) { super.fireEvent(e); } }
/** * addResponse * @param srcPath path of responding node * @param aresponse response of a node */ public void addResponse(String srcPath, Object aresponse) { if (response == null) { response = new ConcurrentHashMap<String, Object>(); } //concurrenthashmap is not able to store null values! if (aresponse != null) { response.put(srcPath, aresponse); } if (responseController != null) { responseController.fireEvent(new Notification(srcPath, aresponse)); } }
/** * {@inheritDoc} */ @Override public void setValue(T object) { if (changeHandler == null || !changeHandler.hasListeners()) { this.value = object; } else { final T oldValue = getValue(); final ChangeEvent event = new ChangeEvent(this, false, false, oldValue, object); changeHandler.fireEvent(event); if (!event.breakEvent) { this.value = object; event.hasChanged = true; changeHandler.fireEvent(event); } } }
cons.addAll(evalTimedConsiliums(cons, timer.from, timer.until)); CommandManager cmdManager = new CommandManager(); getEventController().fireEvent(cons.size()); for (IConsilium c : cons) { if (stop.get()) { eventController.fireEvent(STOPPED); break; eventController.fireEvent(c); log("expired: " + c.getName() + " with timer: "+ c.getTimer()); cmdManager.doIt(c.getExsecutios().toArray(new ICommand[0])); c.setStatus(Status.ACTIVE); c.refreshSeal(ID); eventController.fireEvent(c); } catch (Exception ex) { LOG.error(ex); eventController.fireEvent(ex); eventController.fireEvent(FINISHED); log("processing finished"); log("------------------------------------------------------------------------------");
/** * setValue. informs all registered listeners * * @param value new value */ @Override public void setValue(T value) { final Object oldValue = getValue(); final ChangeEvent event = new ChangeEvent(this, false, false, oldValue, value); changeHandler().fireEvent(event); if (!event.breakEvent) { if (LOG.isDebugEnabled()) { LOG.debug("setting new value for attribute '" + getName() + "': " + value); } setValue(instance, value); if (isDoValidation()) { T assignValue = getValue(); value = //the type may be changed through wrap() value != null && oldValue != assignValue && (getType().equals(Object.class) || !PrimitiveUtil.isAssignableFrom(getType(), value.getClass())) ? assignValue : value; status = isValid(value); } event.hasChanged = true; changeHandler().fireEvent(event); } }
/** * {@inheritDoc} */ @Override public void handleEvent(Notification event) { waitToBeIdle(); increaseStatus(); Net.log_("node " + core + " starts working on " + event + "..."); try { long start = System.currentTimeMillis(); core.handleEvent(event); long workingTime = System.currentTimeMillis() - start; // decreaseStatus(); Net.log("work done on " + event + " in " + workingTime + " msecs"); statistics.addWorkingTime(workingTime); /* * send the notification to all neighbours * each connection has a different weight, the connection.handle() will handle that! */ event.path = null; controller.fireEvent(event); // } catch (Exception ex) { // LOG.error(ex); } finally { setIdle(); } }