/*
(non-Javadoc)

@see
org.apache.log4j.Hierarchy#fireAddAppenderEvent(org.apache.log4j.Category
, org.apache.log4j.Appender)
328818
@Override
    public void fireAddAppenderEvent(Category logger, Appender appender) {
        if (listeners != null) {
            HierarchyEventListener listener;
            for (Iterator<HierarchyEventListener> it = listeners.iterator(); it
                    .hasNext();) {
                listener = it.next();
                listener.addAppenderEvent(logger, appender);
            }
        }
    }
850151
@SuppressWarnings("unchecked")
    public void addItemEventListener(@SuppressWarnings("rawtypes") ItemEventListener listener) {
        StanzaListener conListener = new ItemEventTranslator(listener);
        itemEventToListenerMap.put(listener, conListener);
        pubSubManager.getConnection().addSyncStanzaListener(conListener, new EventContentFilter(EventElementType.items.toString(), "item"));
    }
202922
protected void fireLayerAddedEvent(MapLayer layer, int index) {
		fireLayerHierarchyChangedEvent(new MapLayerHierarchyEvent(this, layer, Type.ADD_CHILD, index, layer.isTemporaryLayer()));
	}
880664
@SuppressWarnings("javadoc")
    protected void firePacketSendingListeners(final TopLevelStreamElement sendTopLevelStreamElement) {
        if (debugger != null) {
            debugger.onOutgoingStreamElement(sendTopLevelStreamElement);
        }

        if (!(sendTopLevelStreamElement instanceof Stanza)) {
            return;
        }
        Stanza packet = (Stanza) sendTopLevelStreamElement;

        final List<StanzaListener> listenersToNotify = new LinkedList<>();
        synchronized (sendListeners) {
            for (ListenerWrapper listenerWrapper : sendListeners.values()) {
                if (listenerWrapper.filterMatches(packet)) {
                    listenersToNotify.add(listenerWrapper.getListener());
                }
            }
        }
        if (listenersToNotify.isEmpty()) {
            return;
        }
        // Notify in a new thread, because we can
        asyncGo(new Runnable() {
            @Override
            public void run() {
                for (StanzaListener listener : listenersToNotify) {
                    try {
                        listener.processStanza(packet);
                    }
                    catch (Exception e) {
                        LOGGER.log(Level.WARNING, "Sending listener threw exception", e);
                        continue;
                    }
                }
            }
        });
    }
1040272
@Override
  protected void fireInsertUpdate( DocumentEvent evt )
  {

    super.fireInsertUpdate( evt );

    try
    {
      processChangedLines( evt.getOffset(), evt.getLength() );
    }
    catch( Exception ex )
    {
      System.out.println( "" + ex );
    }
  }
151529
public void removeAppender(Appender appender) {
        boolean wasAttached = aai.isAttached(appender);
        if (wasAttached) {
            aai.removeAppender(appender);
            fireRemoveAppenderEvent(appender);
        }
    }
244181
protected static void appendHandler(LogRecordHandler parent, LogRecordHandler child){
    RecordHandlerTree p = handlers.find(parent);
    if(p != null){
      p.addChild(child);
    } else {
      throw new IllegalArgumentException("No such parent handler: " + parent);
    }
  }
262192
public void addEvent(final EventType _eventtype,
                         final EventDefinition _eventdef)
        throws CacheReloadException
    {
        List<EventDefinition> evenList = this.events.get(_eventtype);
        if (evenList == null) {
            evenList = new ArrayList<>();
            this.events.put(_eventtype, evenList);
        }
        if (!evenList.contains(_eventdef)) {
            evenList.add(_eventdef);
        }
        // if there are more than one event they must be sorted by their index
        // position
        if (evenList.size() > 1) {
            Collections.sort(evenList, new Comparator<EventDefinition>()
            {
                @Override
                public int compare(final EventDefinition _eventDef0,
                                   final EventDefinition _eventDef1)
                {
                    return Long.compare(_eventDef0.getIndexPos(), _eventDef1.getIndexPos());
                }
            });
        }
        setDirty();
    }
241941
private void fireMessageExceptionedEvent(String apiMsgId,
                                             SIMPMessage message,
                                             int exceptionReason)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc,
                        "fireMessageExceptionedEvent",
                        new Object[] { apiMsgId,
                                      message,
                                      Integer.valueOf(exceptionReason) });

        JsMessagingEngine me = _messageProcessor.getMessagingEngine();
        RuntimeEventListener listener = _messageProcessor.getRuntimeEventListener();

        String systemMessageId = message.getMessage().getSystemMessageId();

        // Check that we have a RuntimeEventListener
        if (listener != null)
        {
            // Build the message for the Notification

            String nlsMessage =
                            nls_mt.getFormattedMessage(
                                                       "MESSAGE_EXCEPTION_DESTINATIONED_CWSJU0012",
                                                       new Object[] {
                                                                     apiMsgId,
                                                                     systemMessageId,
                                                                     _exceptionDestinationName,
                                                                     Integer.valueOf(exceptionReason),
                                                                     message.getMessage().getExceptionMessage() },
                                                       null);

            // Build the properties for the Notification
            Properties props = new Properties();

            // Set values for the intended destination
            String intendedDestinationName = "";
            String intendedDestinationUuid = SIBUuid12.toZeroString();

            if (_originalDestination != null)
            {
                intendedDestinationName = _originalDestination.getName();
                intendedDestinationUuid = _originalDestination.getUuid().toString();
            }
            props.put(SibNotificationConstants.KEY_INTENDED_DESTINATION_NAME,
                      intendedDestinationName);
            props.put(SibNotificationConstants.KEY_INTENDED_DESTINATION_UUID,
                      intendedDestinationUuid);

            // Set values for the exception destination
            props.put(SibNotificationConstants.KEY_EXCEPTION_DESTINATION_NAME,
                      _exceptionDestination.getName());
            props.put(SibNotificationConstants.KEY_EXCEPTION_DESTINATION_UUID,
                      _exceptionDestination.getUuid().toString());

            props.put(SibNotificationConstants.KEY_SYSTEM_MESSAGE_IDENTIFIER,
                      (systemMessageId == null) ? "" : systemMessageId);

            props.put(SibNotificationConstants.KEY_MESSAGE_EXCEPTION_REASON,
                      String.valueOf(exceptionReason));

            // Fire the event
            listener.runtimeEventOccurred(me,
                                          SibNotificationConstants.TYPE_SIB_MESSAGE_EXCEPTIONED,
                                          nlsMessage,
                                          props);
        }
        else
        {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(tc, "Null RuntimeEventListener, cannot fire event");
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "fireMessageExceptionedEvent");
    }
754261
@Override
  protected void subAppend(LoggingEvent event) {
    super.subAppend(event);
    // That should've gone into our writer. Notify the LogContext.
    String logOutput = writer.toString();
    writer.reset();

    OperationLog log = operationManager.getOperationLogByThread();
    if (log == null) {
      LOG.debug(" ---+++=== Dropped log event from thread " + event.getThreadName());
      return;
    }
    log.writeOperationLog(logOutput);
  }
1061801
final void dispatchToAppender(final LoggingEvent customLoggingEvent) {
    // wrap the LoggingEvent in a FileRollEvent to prevent recursion bug
    final FoundationFileRollingAppender appender = this.getSource();
    if (appender != null) {
      appender.append(new FileRollEvent(customLoggingEvent, this));
    }
  }
112383
protected static void fireElementAddedEvent( int index, Object element, JsonConfig jsonConfig ) {
      if( jsonConfig.isEventTriggeringEnabled() ){
         for( Iterator listeners = jsonConfig.getJsonEventListeners()
               .iterator(); listeners.hasNext(); ){
            JsonEventListener listener = (JsonEventListener) listeners.next();
            try{
               listener.onElementAdded( index, element );
            }catch( RuntimeException e ){
               log.warn( e );
            }
         }
      }
   }
327252
protected void fireEventHandler(List<I_CmsEventListener> listeners, CmsEvent event) {

        if (!LOG.isDebugEnabled()) {
            // no logging required
            if ((listeners != null) && (listeners.size() > 0)) {
                // handle all event listeners that listen to this event type
                I_CmsEventListener[] list = listeners.toArray(EVENT_LIST);
                // loop through all registered event listeners
                for (int i = 0; i < list.length; i++) {
                    try {
                        // fire the event
                        list[i].cmsEvent(event);
                    } catch (Throwable t) {
                        LOG.error(
                            Messages.get().getBundle().key(
                                Messages.ERR_CALLING_EVENT_LISTENER_FAILED_2,
                                list[i].getClass().getName(),
                                event.toString()),
                            t);
                    }
                }
            }
        } else {
            // add lots of event debug output (this should usually be disabled)
            // repeat event handling code to avoid multiple "is log enabled" checks in normal operation
            LOG.debug(Messages.get().getBundle().key(Messages.LOG_DEBUG_EVENT_1, event.toString()));
            if ((listeners != null) && (listeners.size() > 0)) {
                // handle all event listeners that listen to this event type
                I_CmsEventListener[] list = listeners.toArray(EVENT_LIST);
                // log the event data
                if (event.getData() != null) {
                    Iterator<String> i = event.getData().keySet().iterator();
                    while (i.hasNext()) {
                        String key = i.next();
                        Object value = event.getData().get(key);
                        LOG.debug(
                            Messages.get().getBundle().key(
                                Messages.LOG_DEBUG_EVENT_VALUE_3,
                                key,
                                value,
                                event.toString()));
                    }
                } else {
                    LOG.debug(Messages.get().getBundle().key(Messages.LOG_DEBUG_NO_EVENT_VALUE_1, event.toString()));
                }
                // log all the registered event listeners
                for (int j = 0; j < list.length; j++) {
                    LOG.debug(
                        Messages.get().getBundle().key(
                            Messages.LOG_DEBUG_EVENT_LISTENERS_3,
                            list[j],
                            new Integer(j),
                            event.toString()));
                }
                // loop through all registered event listeners
                for (int i = 0; i < list.length; i++) {
                    LOG.debug(
                        Messages.get().getBundle().key(
                            Messages.LOG_DEBUG_EVENT_START_LISTENER_3,
                            list[i],
                            new Integer(i),
                            event.toString()));
                    try {
                        // fire the event
                        list[i].cmsEvent(event);
                    } catch (Throwable t) {
                        LOG.error(
                            Messages.get().getBundle().key(
                                Messages.ERR_CALLING_EVENT_LISTENER_FAILED_2,
                                list[i].getClass().getName(),
                                event.toString()),
                            t);
                    }
                    LOG.debug(
                        Messages.get().getBundle().key(
                            Messages.LOG_DEBUG_EVENT_END_LISTENER_3,
                            list[i],
                            new Integer(i),
                            event.toString()));
                }
            } else {
                LOG.debug(Messages.get().getBundle().key(Messages.LOG_DEBUG_EVENT_NO_LISTENER_1, event.toString()));
            }
            LOG.debug(Messages.get().getBundle().key(Messages.LOG_DEBUG_EVENT_COMPLETE_1, event.toString()));
        }
    }
130029
public static void fire(final HasSummernoteChangeHandlers source) {
        if (TYPE != null) {
            SummernoteChangeEvent event = new SummernoteChangeEvent();
            source.fireEvent(event);
        }
    }
835732
public void fireEvent(SystemHookEvent event) throws GitLabApiException {

        if (event instanceof ProjectSystemHookEvent) {
            fireProjectEvent((ProjectSystemHookEvent) event);
        } else if (event instanceof TeamMemberSystemHookEvent) {
            fireTeamMemberEvent((TeamMemberSystemHookEvent) event);
        } else if (event instanceof UserSystemHookEvent) {
            fireUserEvent((UserSystemHookEvent) event);
        } else if (event instanceof KeySystemHookEvent) {
            fireKeyEvent((KeySystemHookEvent) event);
        } else if (event instanceof GroupSystemHookEvent) {
            fireGroupEvent((GroupSystemHookEvent) event);
        } else if (event instanceof GroupMemberSystemHookEvent) {
            fireGroupMemberEvent((GroupMemberSystemHookEvent) event);
        } else if (event instanceof PushSystemHookEvent) {
            firePushEvent((PushSystemHookEvent) event);
        } else if (event instanceof TagPushSystemHookEvent) {
            fireTagPushEvent((TagPushSystemHookEvent) event);
        } else if (event instanceof RepositorySystemHookEvent) {
            fireRepositoryEvent((RepositorySystemHookEvent) event);
        } else if (event instanceof MergeRequestSystemHookEvent) {
            fireMergeRequestEvent((MergeRequestSystemHookEvent) event);
        } else {
            String message = "Unsupported event, event_named=" + event.getEventName();
            LOGGER.warning(message);
            throw new GitLabApiException(message);
        }
    }
813872
void fireEvent() {
        boolean useLock = !isReentrant();
        if (useLock) {
            lock.lock();
        }
        EventImpl event = eventQueue.poll();

        try {
            if (event != null) {
                fireEvent(event);
            }
        } finally {
            if (useLock) {
                lock.unlock();
            }
        }

    }
888953
protected synchronized void fireAttributeAddedEvent(String name, AttributeValue attr) {
		if (this.listenerList != null && isEventFirable()) {
			final AttributeChangeListener[] list = new AttributeChangeListener[this.listenerList.size()];
			this.listenerList.toArray(list);
			final AttributeChangeEvent event = new AttributeChangeEvent(
					this,
					Type.ADDITION,
					null,
					null,
					name,
					attr);
			for (final AttributeChangeListener listener : list) {
				listener.onAttributeChangeEvent(event);
			}
		}
	}