Used to handle a generated notification:
- sending the notifications to the clients which subscribed to the
associated event.
- saving the notification in the history.
@param n
343060
@Override
  public void handleNotification(NamespaceNotification n) {
    int queuedCount = 0;
    if (LOG.isDebugEnabled()) {
      LOG.debug("Handling " + NotifierUtils.asString(n) + " ...");
    }

    // Add the notification to the queues
    Set<Long> clientsForNotification = getClientsForNotification(n);
    if (clientsForNotification != null && clientsForNotification.size() > 0) {
      synchronized (clientsForNotification) {
        for (Long clientId : clientsForNotification) {
          ConcurrentLinkedQueue<NamespaceNotification> clientQueue =
              clientsData.get(clientId).queue;
          // Just test that the client wasn't removed meanwhile
          if (clientQueue == null) {
            continue;
          }
          clientQueue.add(n);
          queuedCount ++;
        }
      }
      
      ServerDispatcher.queuedNotificationsCount.addAndGet(queuedCount);
    }
    
    // Save it in history
    serverHistory.storeNotification(n);
    
    if (LOG.isDebugEnabled()) {
      LOG.debug("Done handling " + NotifierUtils.asString(n));
    }
  }
148777
public void onNotify(Notify ntfy,
			SubscriptionClientChildSbbLocalObject subscriptionChild) {
		// compile diff
		if (ntfy.getStatus().equals(SubscriptionStatus.terminated)) {
			try {
				final String notifier = ntfy.getNotifier();
				subscriptionChild.remove();
				getParent()
						.subscriptionTerminated(
								(XDMClientChildSbbLocalObject) this.sbbContext
										.getSbbLocalObject(),
								notifier, ntfy.getTerminationReason());
			} catch (Exception e) {
				tracer.severe("Unexpected exception on callback!", e);
			}
		} else {
			// cast is safe, cause we expect diff and check MIME
			XcapDiff diff = null;
			if (ntfy != null) {
				try {
					diff = (XcapDiff) xcapDiffJaxbContext.createUnmarshaller()
							.unmarshal(new StringReader(ntfy.getContent()));
				} catch (Exception e) {
					tracer.severe("Failed to parse diff!", e);
				}
			}
			getParent().subscriptionNotification(diff, ntfy.getStatus());
		}

	}
748551
@Override
  public void onEvent(Context context, Event event, Bundle extras) {
    LOGGER.d("received Notify Event. Event=" + event);
    if (Event.NOTIFICATION_CLICK_BTN.equals(event) || Event.NOTIFICATION_OPENED.equals(event)) {
      int notifyId = extras.getInt(BOUND_KEY.pushNotifyId, 0);
      LOGGER.d("received Push Event. notifyId:" + notifyId);
      if (0 != notifyId) {
        NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        manager.cancel(notifyId);
      }
    } else {
      LOGGER.d("unknow event.");
    }
    super.onEvent(context, event, extras);
  }
1192105
void notifyObservers(ApptentiveNotification notification) {
		boolean hasLostReferences = false;

		// create a temporary list of observers to avoid concurrent modification errors
		List<ApptentiveNotificationObserver> temp = new ArrayList<>(observers.size());
		for (int i = 0; i < observers.size(); ++i) {
			ApptentiveNotificationObserver observer = observers.get(i);
			ObserverWeakReference observerRef = ObjectUtils.as(observer, ObserverWeakReference.class);
			if (observerRef == null || !observerRef.isReferenceLost()) {
				temp.add(observer);
			} else {
				hasLostReferences = true;
			}
		}

		// notify observers
		for (int i = 0; i < temp.size(); ++i) {
			try {
				temp.get(i).onReceiveNotification(notification);
			} catch (Exception e) {
				ApptentiveLog.e(e, "Exception while posting notification: %s", notification);
				logException(e); // TODO: add more context info
			}
		}

		// clean lost references
		if (hasLostReferences) {
			for (int i = observers.size() - 1; i >= 0; --i) {
				final ObserverWeakReference observerRef = ObjectUtils.as(observers.get(i), ObserverWeakReference.class);
				if (observerRef != null && observerRef.isReferenceLost()) {
					observers.remove(i);
				}
			}
		}
	}
625311
private void postRoutedServerNotificationListenerRegistrationEvent(String operation, NotificationTargetInformation nti, ObjectName listener,
                                                                       NotificationFilter filter, Object handback) {
        Map<String, Object> props = createServerListenerRegistrationEvent(operation, nti, listener, filter, handback);
        safePostEvent(new Event(REGISTER_JMX_NOTIFICATION_LISTENER_TOPIC, props));
    }
75316
def handleNotification(self, handle, data):
        """"""
        _LOGGER.debug("Got notification from %s: %s", handle, codecs.encode(data, 'hex'))
        if handle in self._callbacks:
            self._callbacks[handle](data)
102973
public void add(T notification) {
        notificationArray.remove(notification.getId());
        notificationArray.put(notification.getId(), notification);
    }
1141953
protected void onServiceInstanceUnavailable(ServiceInstance instance){
        if(instance == null){
            return ;
        }
        String serviceName = instance.getServiceName();
        synchronized(notificationHandlers){
            if(notificationHandlers.containsKey(serviceName)){
                for(NotificationHandler h : notificationHandlers.get(serviceName)){
                    h.serviceInstanceUnavailable(instance);
                }
            }
        }
    }
595854
protected void sendEvent(T event, Object receiver, CreationalContext<?> creationalContext) {
        try {
            preNotify(event, receiver);
            // As we are working with the contextual instance, we may not have the
            // actual object, but a container proxy (e.g. EJB)
            notificationStrategy.invoke(receiver, observerMethod, event, beanManager, creationalContext);
        } finally {
            postNotify(event, receiver);
        }
    }
318234
public synchronized void handleNotification(Notification notification, Object handback) {
        String type = notification.getType();
        if (REGISTRATION_NOTIFICATION.equals(type)) {
            jolokiaMBeanServer = lookupJolokiaMBeanServer();
            // We need to add the listener provided during construction time to add the Jolokia MBeanServer
            // so that it is kept updated, too.
            if (jolokiaMBeanServerListener != null) {
                JmxUtil.addMBeanRegistrationListener(jolokiaMBeanServer, jolokiaMBeanServerListener, null);
            }
        } else if (UNREGISTRATION_NOTIFICATION.equals(type)) {
            jolokiaMBeanServer = null;
        }

        allMBeanServers.clear();
        if (jolokiaMBeanServer != null) {
            allMBeanServers.add(jolokiaMBeanServer);
        }
        allMBeanServers.addAll(detectedMBeanServers);
    }
1228099
@Override
    protected void enqueueNotification(final Notification not) {
        not.lastRun = System.currentTimeMillis();
        final SubscriptionSummary summary = postNotification(not.subscriber, not.mimeType, not.payload);
        not.callback.onSummaryInfo(summary);
    }
934474
public void post(Notification event) {
        for (Map.Entry<Object, List<SubscriberMethod>> entry : listeners.entrySet()) {
            for (SubscriberMethod method : entry.getValue()) {
                if (method.eventTypeToInvokeOn.isInstance(event)) {
                    try {
                        method.methodToInvokeOnEvent.invoke(entry.getKey(), event);
                    } catch (InvocationTargetException e) {
                        // We log this exception and swallow it because we need to ensure we don't
                        // prevent completion of notifications if one listener is badly behaved and
                        // throws an exception of some kind.
                        LOGGER.log(Level.SEVERE, "Subscriber invocation failed for method \""
                                + method.toString() + "\"", e);
                    } catch (IllegalAccessException e) {
                        throw new RuntimeException(EventBus.class.getName() + " could not access " +
                                "subscriber " + method.toString(), e);
                    }
                }
            }
        }
    }
618936
public void sendNotification(final Notification notification) {

    ContextAwareTimer.Context timer = this.notificationTimer.time();
    if(!this.notificationTargets.isEmpty()) {
        for (final Map.Entry<UUID, Function<Notification, Void>> entry : this.notificationTargets.entrySet()) {
          try {
            entry.getValue().apply(notification);
          } catch (RuntimeException exception) {
            LOG.warn("RuntimeException when running notification target. Skipping.", exception);
          }
        }
    }

    if(getParent().isPresent()) {
      getParent().get().sendNotification(notification);
    }
    timer.stop();
  }
1287357
protected void onServiceInstanceUnavailable(ServiceInstance instance){
        if(instance == null){
            return ;
        }
        String serviceName = instance.getServiceName();
        List<NotificationHandler> handlerList = new ArrayList<NotificationHandler>();
        synchronized (notificationHandlers) {
            if (notificationHandlers.containsKey(serviceName)) {
                handlerList.addAll(notificationHandlers.get(serviceName));
            }
        }
        for(NotificationHandler h : handlerList) {
            h.serviceInstanceUnavailable(instance);
        }
    }
377505
@Override
    public void handleNotification(Notification notification, Object handback) {
       try {
           method.invoke(target, notification, handback);
       } catch (Exception e) {
           LOG.error("Could not invoke MessageListener method " + method + " on " + target, e);
       }
        
    }
475763
function postPublicNotification(Notification $n)
	{
		return $this->manialinkPublisher->postPublicNotification($n->message, $n->link, $n->iconStyle, $n->iconSubStyle);
	}
784999
private void sendRecordStopNotify() {
        Status stopStatus = new Status(StatusCodes.NS_RECORD_STOP);
        stopStatus.setClientid(getStreamId());
        stopStatus.setDetails(getPublishedName());

        StatusMessage stopMsg = new StatusMessage();
        stopMsg.setBody(stopStatus);
        pushMessage(stopMsg);
    }