private void initEventQueue(Engine engine) { ExecutionEventQueue newEventQueue = CachingExecutionEventQueue.newArrayListInstance(); ListenerCache cache = CachingExecutionEventQueue.getListenerCache(); for (HibProcessListener listener : getListeners()) { newEventQueue.addListener( engine, cache.getListener(listener.getType()), listener.getEventType()); } eventQueue = newEventQueue; }
@Override public void addExecutionListener(ExecutionListener listener, ExecutionEventType... eventTypes) { if (eventTypes == null || listener == null) { return; } globalEventQueue.addListener(this, listener, eventTypes); listenerCache.ensureContainsListenerType(listener); }
@Override public void fireEvent(final ExecutionEvent event) { globalEventQueue.fireEvent(event); event.getProcess().getEventQueue().fireEvent(event); }
@Override public void removeExecutionListener( final ExecutionListener listener, final ExecutionEventType... eventTypes) { globalEventQueue.removeListener(this, listener, eventTypes); }
@Override public void removeListener( Engine engine, ExecutionListener listener, ExecutionEventType... eventTypes) { initEventQueue(engine); eventQueue.removeListener(engine, listener, eventTypes); }
@Override public void fireEvent(ExecutionEvent event) { initEventQueue(event.getEngine()); eventQueue.fireEvent(event); }