/* (non-Javadoc)
@see com.ibm.jverbs.endpoints.ICmConsumer#dispatchCmEvent(com.ibm.jverbs.cm.RdmaCmEvent)
966999
public synchronized void dispatchCmEvent(RdmaCmEvent cmEvent)
			throws IOException {
		try {
			int eventType = cmEvent.getEvent();
			if (eventType == RdmaCmEvent.EventType.RDMA_CM_EVENT_ADDR_RESOLVED.ordinal()) {
				connState = RdmaEndpoint.CONN_STATE_ADDR_RESOLVED;
				notifyAll();
			} else if (cmEvent.getEvent() == RdmaCmEvent.EventType.RDMA_CM_EVENT_ROUTE_RESOLVED.ordinal()) {
				connState = RdmaEndpoint.CONN_STATE_ROUTE_RESOLVED;
				notifyAll();
			} else if (eventType == RdmaCmEvent.EventType.RDMA_CM_EVENT_ESTABLISHED.ordinal()) {
				logger.info("got event type + RDMA_CM_EVENT_ESTABLISHED, srcAddress " + this.getSrcAddr() + ", dstAddress " + this.getDstAddr());
				connState = CONN_STATE_CONNECTED;
				notifyAll();
			} else if (eventType == RdmaCmEvent.EventType.RDMA_CM_EVENT_DISCONNECTED.ordinal()) {
				logger.info("got event type + RDMA_CM_EVENT_DISCONNECTED, srcAddress " + this.getSrcAddr() + ", dstAddress " + this.getDstAddr());
				connState = CONN_STATE_CLOSED;
				notifyAll();
			} else if (eventType == RdmaCmEvent.EventType.RDMA_CM_EVENT_CONNECT_REQUEST.ordinal()) {
				logger.info("got event type + RDMA_CM_EVENT_CONNECT_REQUEST, srcAddress " + this.getSrcAddr() + ", dstAddress " + this.getDstAddr());
			} else {
				logger.info("got event type + UNKNOWN, srcAddress " + this.getSrcAddr() + ", dstAddress " + this.getDstAddr());
			}
		} catch (Exception e) {
			throw new IOException(e);
		}
	}
298179
public void messageReceived (MessageEvent event)
    {
        if (_msghandlers != null) {
            MessageHandler handler = _msghandlers.get(event.getName());
            if (handler != null) {
                handler.handleEvent(event, this);
            }
        }

        // If the message is directed at us, see if it's a request for a method invocation
        if (event.isPrivate()) { // aka if (event instanceof ServerMessageEvent)
            // the first argument should be the client object of the caller or null if it is
            // a server-originated event
            int srcoid = event.getSourceOid();
            DObject source = (srcoid <= 0) ? null : _omgr.getObject(srcoid);
            String method = event.getName();
            Object[] args = event.getArgs(), nargs;

            // validate that this call is allowed
            if (!allowManagerCall(method)) {
                log.warning("Client tried to invoke forbidden manager call!",
                    "source", source, "method", method, "args", args);
                return;
            }

            if (args == null) {
                nargs = new Object[] { source };
            } else {
                nargs = new Object[args.length+1];
                nargs[0] = source;
                System.arraycopy(args, 0, nargs, 1, args.length);
            }

            // Lazily create our dispatcher now that it's actually getting a message
            if (_dispatcher == null) {
                Class<?> clazz = getClass();
                MethodFinder finder = _dispatcherFinders.get(clazz);
                if (finder == null) {
                    finder = new MethodFinder(clazz);
                    _dispatcherFinders.put(clazz, finder);
                }
                _dispatcher = new DynamicListener<DSet.Entry>(this, finder);
            }
            _dispatcher.dispatchMethod(method, nargs);
        }
    }
1106267
function forEachEventDispatch(event, cb) {
  var dispatchListeners = event._dispatchListeners;
  var dispatchIDs = event._dispatchIDs;
  if ("production" !== "development") {
    validateEventDispatches(event);
  }
  if (Array.isArray(dispatchListeners)) {
    for (var i = 0; i < dispatchListeners.length; i++) {
      if (event.isPropagationStopped()) {
        break;
      }
      // Listeners and IDs are two parallel arrays that are always in sync.
      cb(event, dispatchListeners[i], dispatchIDs[i]);
    }
  } else if (dispatchListeners) {
    cb(event, dispatchListeners, dispatchIDs);
  }
}
1345845
private void dispatchMessage(PushMessageListener listener, RemoteMessage message) {
        if (listener != null) {
            mainThreadHandler.post(() -> listener.onMessageReceived(message));
        }
    }
731414
protected boolean dispatchEvent (DEvent event, DObject target)
    {
        boolean notify = true; // assume always notify
        try {
            // do any internal management necessary based on this event
            EventHelper helper = _helpers.get(event.getClass());
            if (helper != null) {
                // if helper returns false, we abort event processing
                if (!helper.invoke(event, target)) {
                    return false;
                }
            }

            // everything's good so far, apply the event to the object
            notify = event.applyToObject(target);

            // if the event returns false from applyToObject, this means it's a silent event and we
            // shouldn't notify the listeners
            if (notify) {
                target.notifyListeners(event);
            }

        } catch (VirtualMachineError e) {
            handleFatalError(event, e);

        } catch (Throwable t) {
            log.warning("Failure processing event", "event", event, "target", target, t);
        }

        // track the number of events dispatched
        ++_eventCount;
        ++_current.eventCount;
        return true;
    }
1021830
public static void fireCmsEvent(int type, Map<String, Object> data) {

        OpenCmsCore.getInstance().getEventManager().fireEvent(type, data);
    }
621708
public void callManager(final Event event, final Callback callback) {
        if (delegate instanceof DefaultCommunicationClientImpl) {
            DefaultCommunicationClientImpl defaultClient = (DefaultCommunicationClientImpl) delegate;
            defaultClient.submit(new Runnable() {

                @Override
                public void run() {
                    Object result = callManager(event);
                    callback.call(result);
                }
            });
        }
    }
1019312
public static void dispatch(Object target, Event event, String methodName) {
        try {
            MethodUtils.invokeMethod(target, methodName, event);
        } catch (InvocationTargetException e) {
            if (e.getTargetException() instanceof RuntimeException) {
                throw (RuntimeException) e.getTargetException();
            } else {
                throw new UnsupportedOperationException(e.getTargetException());
            }
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new UnsupportedOperationException(e);
        }
    }
1282909
final void dispatchToAppender(final String message) {
    // dispatch a copy, since events should be treated as being immutable
    final FoundationFileRollingAppender appender = this.getSource();
    if (appender != null) {
      appender.append(new FileRollEvent(this, message));
    }
  }
117756
public void onMessageEvent(javax.sip.RequestEvent event,
			ActivityContextInterface aci) {

		final Request request = event.getRequest();
		try {
			// message body should be *FIRST_TOKEN<timer value in
			// seconds>MIDDLE_TOKEN<msg to send back to UA>LAST_TOKEN*
			final String body = new String(request.getRawContent());
			final int firstTokenStart = body.indexOf(FIRST_TOKEN);
			final int timerDurationStart = firstTokenStart + FIRST_TOKEN_LENGTH;
			final int middleTokenStart = body.indexOf(MIDDLE_TOKEN,
					timerDurationStart);
			final int bodyMessageStart = middleTokenStart + MIDDLE_TOKEN_LENGTH;
			final int lastTokenStart = body.indexOf(LAST_TOKEN,
					bodyMessageStart);
			if (firstTokenStart > -1 && middleTokenStart > -1
					&& lastTokenStart > -1) {
				// extract the timer duration
				final int timerDuration = Integer.parseInt(body.substring(
						timerDurationStart, middleTokenStart));
				// create a null AC and attach the sbb local object
				final ActivityContextInterface timerACI = this.nullACIFactory
						.getActivityContextInterface(this.nullActivityFactory
								.createNullActivity());
				timerACI.attach(sbbContext.getSbbLocalObject());
				// set the timer on the null AC, because the one from this event
				// will end as soon as we send back the 200 ok
				this.timerFacility.setTimer(timerACI, null, System
						.currentTimeMillis()
						+ (timerDuration * 1000), new TimerOptions());
				// extract the body message
				final String bodyMessage = body.substring(bodyMessageStart,
						lastTokenStart);
				// store it in a cmp field
				setBody(bodyMessage);
				// do the same for the call id
				setCallId((CallIdHeader) request.getHeader(CallIdHeader.NAME));
				// also store the sender's address, so we can send the wake up
				// message
				final FromHeader fromHeader = (FromHeader) request
						.getHeader(FromHeader.NAME);
				if (tracer.isInfoEnabled()) {
					tracer.info("Received a valid message from "
							+ fromHeader.getAddress()
							+ " requesting a reply containing '" + bodyMessage
							+ "' after " + timerDuration + "s");
				}
				setSender(fromHeader.getAddress());
				// finally reply to the SIP message request
				sendResponse(event, Response.OK);
			} else {
				// parsing failed
				tracer.warning("Invalid msg '" + body + "' received");
				sendResponse(event, Response.BAD_REQUEST);
			}
		} catch (Throwable e) {
			// oh oh something wrong happened
			tracer.severe("Exception while processing MESSAGE", e);
			try {
				sendResponse(event, Response.SERVER_INTERNAL_ERROR);
			} catch (Exception f) {
				tracer.severe("Exception while sending SERVER INTERNAL ERROR",
						f);
			}
		}
	}
1293995
private void dispatchToConversationListenerMethod(WsByteBuffer data, ConversationImpl conversation)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchToConversationListenerMethod", new Object[]{data, conversation});
      boolean bailOut = false;

      if (conversation == null)
      {
         // Must be an attempt to start a new conversation.
         if (onClientSide)
         {
            // This is an error!
            bailOut = true;
         }
         else
         {
            // On the server side we assume any previously unseend
            // conversation id means that the client is stricking up a
            // conversation with us.
            conversation = new ConversationImpl((short)conversationHeaderFields.conversationId, false, connection, null);

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "accepting new conversation");

            ConversationReceiveListener rl = null;
            boolean badReceiveListener = false;
            try
            {
               rl = acceptListener.acceptConnection(conversation);
            }
            catch(Throwable t)
            {
               FFDCFilter.processException
                  (t, "com.ibm.ws.sib.jfapchannel.impl.ConnectionReadCompletedCallback", JFapChannelConstants.INBOUNDXMITPARSER_DISPCONVLST_01);
               if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "exception thrown from acceptConnection");
               if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, t.getMessage());

               // Oh dear, user managed to throw an exception in their callback.
               badReceiveListener = true;
               bailOut = true;
            }

            // If the user did not supply us with a receive listener (either through
            // incompetence or throwning an exception) make our own.  We need one before
            // we can finish establishing the conversation and the cleanest way to dump the
            // conversation is to finish establishing it then close it.
            if (rl == null)
            {
               if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "bad receive listener");
               badReceiveListener = true;
               bailOut = true;
               rl = new BadReceiveListener();
            }

            conversation.setDefaultReceiveListener(rl);
            try
            {
               conversation = connection.startNewConversation(conversation);

               if (badReceiveListener)
               {
                  try
                  {
                     conversation.close();
                  }
                  catch (SIResourceException e)
                  {
                     FFDCFilter.processException
                        (e, "com.ibm.ws.sib.jfapchannel.impl.ConnectionReadCompletedCallback", JFapChannelConstants.INBOUNDXMITPARSER_DISPCONVLST_02);
                     if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "exception thrown closing conversation");
                     if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(this, tc, e);

                     // Hmmn, something went wrong trying to close the logical conversation.
                     // Bring down the whole conneciton.
                     connection.invalidate(false, e, "SIResourceError when closing conversation - "+e.getMessage()); // D224570
                     bailOut = true;
                  }
               }
            }
            catch(SIResourceException e)
            {
               // No FFDC code needed
               // (FFDC taken at source of exception)
               try
               {
                  conversation.close();
               }
               catch(Exception e2)
               {
                  // No FFDC code needed
                  // (already broken)
               }

               connection.invalidate(true, e, "SIResourceError when creating conversation - "+e.getMessage());
            }
         }
      }

      if (!bailOut)
      {

         RequestIdTable reqIdTable = null;
         if (conversation != null)
            reqIdTable = conversation.getRequestIdTable();

         // Is this request something we were expecting a reply for?
         if ((reqIdTable != null) && reqIdTable.containsId(conversationHeaderFields.requestNumber))
         {
            ReceiveListener listener = reqIdTable.getListener(conversationHeaderFields.requestNumber);
            reqIdTable.remove(conversationHeaderFields.requestNumber);

            if (listener != null)
            {
               if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "listener: "+listener+" conversaion: "+conversation);

               ReceiveListenerDispatcher.getInstance(conversation.getConversationType(), conversation.isOnClientSide()).        // D242116
                queueDataReceivedInvocation
                  (connection, listener, data, primaryHeaderFields.segmentType,
                     conversationHeaderFields.requestNumber, primaryHeaderFields.priority, primaryHeaderFields.isPooled,
                     primaryHeaderFields.isExchange, conversation);
            }
            else
            {
               // It should be impossible to get to here and discover that
               // the associated entry in the request table has a null
               // receive listener...
               if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Entry "+conversationHeaderFields.requestNumber+" in request table has null listener");

               // Probably better stop talking to our peer - just to be on the safe side.
               connection.invalidate(true, null, "no receive listener for conversation "+conversationHeaderFields.requestNumber); // F176003, D224570
            }

         }
         else
         {
            // We weren't expecting this reply - notify the 'default' request
            // listener associated with this conversation...
            ConversationReceiveListener listener =                                 // F174776
               conversation.getDefaultReceiveListener();
            //if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "invokeCallback", "default receive listener: "+listener);
            if (listener == null)
            {
               // Earlier error checking should prevent us ever getting into
               // this condition.
               //if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "No default receive listener");

               // Since we can't really continue, probably best to stop talking
               // to our peer now.
               connection.invalidate(true, null, "no default receive listener");    // F176003, D224570
            }
            else
            {
               ReceiveListenerDispatcher.getInstance(conversation.getConversationType(), conversation.isOnClientSide()).        // D242116
                queueDataReceivedInvocation
                  (connection, listener, data, primaryHeaderFields.segmentType,
                  conversationHeaderFields.requestNumber, primaryHeaderFields.priority, primaryHeaderFields.isPooled,
                  primaryHeaderFields.isExchange, conversation);
            }
         }

      }//if(!bailOut)

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchToConversationListenerMethod");
   }
750080
public void eventReceived (DEvent event)
    {
        if (event instanceof InvocationResponseEvent) {
            InvocationResponseEvent ire = (InvocationResponseEvent)event;
            handleInvocationResponse(ire.getRequestId(), ire.getMethodId(), ire.getArgs());

        } else if (event instanceof InvocationNotificationEvent) {
            InvocationNotificationEvent ine = (InvocationNotificationEvent)event;
            handleInvocationNotification(ine.getReceiverId(), ine.getMethodId(), ine.getArgs());

        } else if (event instanceof MessageEvent) {
            MessageEvent mevt = (MessageEvent)event;
            if (mevt.getName().equals(ClientObject.CLOBJ_CHANGED)) {
                handleClientObjectChanged(((Integer)mevt.getArgs()[0]).intValue());
            }
        }
    }
320209
public void dispatch_event(final EventData eventData) {
        final TangoDataReady tangoDataReady = this;
        if (EventUtil.graphicAvailable()) {
                //   Causes doRun.run() to be executed asynchronously
                //      on the AWT event dispatching thread.
            Runnable do_work_later = new Runnable() {
                public void run() {
                    fireTangoDataReadyEvent(tangoDataReady, eventData);
                }
            };
            SwingUtilities.invokeLater(do_work_later);
        }
        else
            fireTangoDataReadyEvent(tangoDataReady, eventData);
    }
1007693
@Override
    public void dispatch(@Nonnull final NessEvent event)
    {
        if (event == null) {
            LOG.trace("Dropping null event");
        }
        else {

            for (final NessEventReceiver receiver : eventReceivers) {
                try {
                    if (receiver.accept(event)) {
                        receiver.receive(event);
                    }
                } catch (Exception e) {
                    // don't reraise. We prefer to not disrupt event handling by other receievers
                    LOG.error(e, "Exception during event handling by %s of event %s", receiver, event);
                }
            }
        }
    }
1369434
public void onInviteEvent(javax.sip.RequestEvent requestEvent,
			ActivityContextInterface aci) {

		final ServerTransaction serverTransaction = requestEvent
				.getServerTransaction();

		try {
			// send "trying" response
			Response response = messageFactory.createResponse(Response.TRYING,
					requestEvent.getRequest());
			serverTransaction.sendResponse(response);
			// get local object
			final SbbLocalObject sbbLocalObject = this.sbbContext
					.getSbbLocalObject();
			
			// send 180
			response = messageFactory.createResponse(Response.RINGING,
					requestEvent.getRequest());
			serverTransaction.sendResponse(response);

			setFinalReplySent(false);
			// set timer of 1 secs on the dialog aci to send 200 OK after that
			timerFacility.setTimer(aci, null,
					System.currentTimeMillis() + 1000L, getTimerOptions());			
						
		} catch (Exception e) {
			getTracer().severe("failure while processing initial invite", e);
		}
	}
675969
protected void dispatchEvent (DEvent event)
    {
//         Log.info("Dispatching event: " + evt);

        // look up the object on which we're dispatching this event
        int remoteOid = event.getTargetOid();
        DObject target = _ocache.get(remoteOid);
        if (target == null) {
            if (!_dead.containsKey(remoteOid)) {
                log.warning("Unable to dispatch event on non-proxied object " + event + ".");
            }
            return;
        }

        // because we might be acting as a proxy for a remote server, we may need to fiddle with
        // this event before we dispatch it
        _client.convertFromRemote(target, event);

        // if this is a compound event, we need to process its contained events in order
        if (event instanceof CompoundEvent) {
            // notify our proxy subscribers in one fell swoop
            target.notifyProxies(event);

            // now break the event up and dispatch each event to listeners individually
            List<DEvent> events = ((CompoundEvent)event).getEvents();
            int ecount = events.size();
            for (int ii = 0; ii < ecount; ii++) {
                dispatchEvent(remoteOid, target, events.get(ii));
            }

        } else {
            // forward to any proxies (or not if we're dispatching part of a compound event)
            target.notifyProxies(event);

            // and dispatch the event to regular listeners
            dispatchEvent(remoteOid, target, event);
        }
    }
1033258
public void dispatch_event(final EventData eventData) {
		final TangoPipe tangoPipe = this;
        if (EventUtil.graphicAvailable()) {
                //   Causes doRun.run() to be executed asynchronously
                //      on the AWT event dispatching thread.
            Runnable do_work_later = new Runnable() {
                public void run() {
                    fireTangoPipeEvent(tangoPipe, eventData);
                }
            };
            SwingUtilities.invokeLater(do_work_later);
        }
        else
            fireTangoPipeEvent(tangoPipe, eventData);
    }