NotificationListener listener, NotificationFilter filter, Object handback
974572
def removeNotificationListener(listener, filter=nil, handback=nil)
      found = false
      listeners.delete_if do |clistener, (cfilter, chandback)|
        v = listener == clistener && filter == cfilter && handback == chandback
        found = true if v
        v
      end
      raise javax.management.ListenerNotFoundException.new unless found
    end
953843
function listener({ target }) {
        target.removeEventListener(TRANSITION_END, listener);

        if (++ran === pending) {
            ended = true;
            classList.remove(className);

            if (cb) {
                cb();
            }
        }
    }
1181717
function notify(gobj, source) {
	const state = gobj.__gawk__;

	if (source === undefined) {
		source = gobj;
	}

	// if we're paused, add this object to the list of objects that may have changed
	if (state.queue) {
		state.queue.add(gobj);
		return;
	}

	// notify all of this object's listeners
	if (state.listeners) {
		for (const [ listener, filter ] of state.listeners) {
			if (filter) {
				const { found, obj } = filterObject(gobj, filter);

				// compute the hash of the stringified value
				const hash = hashValue(obj);

				// check if the value changed
				if ((found && !state.previous) || (state.previous && hash !== state.previous.get(listener))) {
					listener(obj, source);
				}

				if (!state.previous) {
					state.previous = new WeakMap();
				}

				state.previous.set(listener, hash);
			} else {
				listener(gobj, source);
			}
		}
	}

	// notify all of this object's parents
	if (state.parents) {
		for (const parent of state.parents) {
			notify(parent, source);
		}
	}
}
1068521
public void handleNotification(Notification notification, Object obj) {
        // handle JMX connection status notification
        if (notification instanceof JMXConnectionNotification) {
            JMXConnectionNotification jmxcNotification = (JMXConnectionNotification) notification;
            if (jmxcNotification.getType().equals(JMXConnectionNotification.FAILED)) {
                logger.error(
                      "JMX connection to " + componentName + " (" + jmxcNotification.getConnectionId() + ") has been lost !\n"
                            + jmxcNotification.getMessage());
                propertiesHistory.signalPossibleNotificationLoss();
            } else if (jmxcNotification.getType().equals(JMXConnectionNotification.NOTIFS_LOST)) {
                logger.error("JMX connection to " + componentName + " (" + jmxcNotification.getConnectionId()
                      + ") could have lost some notifications:\n" + jmxcNotification.getMessage());
                /*
                 if (jmxcNotification.getUserData() instanceof Long) {
                    lastNotificationSequenceNumber += (Long)jmxcNotification.getUserData();
                }*/
                propertiesHistory.signalPossibleNotificationLoss();
            }
            return;
        }

        // handle JMX attribute change notification
        if (!(notification instanceof AttributeChangeNotification)) {
            logger.error(
                  "Received a JMX notification from " + componentName + " which is not of type AttributeChangeNotification ("
                        + notification.getClass().getName() + ")");
            return;
        }

        AttributeChangeNotification attributeChangeNotification = (AttributeChangeNotification) notification;
        Object source = attributeChangeNotification.getSource();
        if (!(source instanceof String)) {
            // ignore AttributeChangeDetected sent by RequiredModelMBean#sendAttributeChangeNotification because sequence
            // number is always set to 1
            if (source instanceof ObjectName && "AttributeChangeDetected".equals(attributeChangeNotification.getMessage())) {
                logger.warn("Ignoring JMX AttributeChangeDetected notification from " + componentName + " for attribute "
                      + attributeChangeNotification.getAttributeName());
            } else {
                logger.error(
                      "JMX notification source from " + componentName + " is not of type String (" + source.getClass().getName()
                            + ")");
            }
            return;
        }

        // check that we didn't miss a notification
        long notificationSequenceNumber = notification.getSequenceNumber();
        if (lastNotificationSequenceNumber != -1) {
            if (notificationSequenceNumber != (lastNotificationSequenceNumber + 1)) {
                logger.error("Missed a JMX notification from " + componentName + "! (Received sequence number "
                      + notificationSequenceNumber + " while last was " + lastNotificationSequenceNumber + ")");
                propertiesHistory.signalPossibleNotificationLoss();
            }
        }
        lastNotificationSequenceNumber = notificationSequenceNumber;

        String message = attributeChangeNotification.getMessage();
        int separatorIndex = message.indexOf(':');
        String subComponent = ((separatorIndex != -1) ? message.substring(0, separatorIndex) : "");
        String subComponentName = subComponentsMap.get(subComponent);
        if (subComponentName == null) {
            logger.error("Received JMX notification from " + componentName + " from unknown sub-component " + subComponent
                  + " - message: " + attributeChangeNotification.getMessage());
            return;
        }

        String attributeName = attributeChangeNotification.getAttributeName();
        // remove "prefix." or "prefix:" if any
        int dotIndex = attributeName.lastIndexOf('.');
        if (dotIndex < 0) {
            dotIndex = attributeName.lastIndexOf(':');
        }
        if (dotIndex > 0) {
            if (dotIndex == attributeName.length() - 1) {
                logger.error("Received JMX notification from " + componentName + " for empty attribute name: " + attributeName);
                return;
            }
            attributeName = attributeName.substring(dotIndex + 1);
        }
        // rename "StateProperty" into "state"
        if (attributeName.equals("StateProperty")) {
            attributeName = "state";
        }

        String propertyName =
              (subComponentName.isEmpty() ? "" : subComponentName.toLowerCase() + ".") + attributeName.toLowerCase();
        String oldValue = String.valueOf(attributeChangeNotification.getOldValue()).toLowerCase();
        String newValue = String.valueOf(attributeChangeNotification.getNewValue()).toLowerCase();

        // hack to get "null" string if the String is empty ("")
        if (oldValue.isEmpty()) {
            oldValue = "null";
        }
        if (newValue.isEmpty()) {
            newValue = "null";
        }

        boolean checkOldValue = (attributeChangeNotification.getOldValue() != null);

        propertiesHistory.addChange(propertyName, oldValue, newValue, notificationSequenceNumber, checkOldValue);
    }
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)
29813
private void notifyListeners() {
        WriterListener[] writerListeners;
        synchronized (listeners) {
            writerListeners = new WriterListener[listeners.size()];
            listeners.toArray(writerListeners);
        }
        String str = stringBuilder.toString();
        stringBuilder.setLength(0);
        for (WriterListener writerListener : writerListeners) {
            writerListener.write(str);
        }
    }
494053
public Object[] setEnableNonFilter(Object[] rgobjEnable, boolean bHasNext, boolean bBreak, boolean bAfterRequery, boolean bSelectEOF, boolean bFieldListeners)
    {
        boolean bEnable = (rgobjEnable == null) ? false : true;
        if (bFieldListeners)
        {
            if (rgobjEnable == null)
                rgobjEnable = this.setEnableFieldListeners(bEnable);
            else
                this.setEnableFieldListeners(rgobjEnable);
        }
        else
        {
            if (rgobjEnable == null)
                rgobjEnable = new Object[0];
        }
        FileListener listener = this.getListener();
        int iCount = this.getFieldCount();
        while (listener != null)
        {
            if (!(listener instanceof org.jbundle.base.db.filter.FileFilter))
            {
                if (!bEnable)
                {
                    rgobjEnable = Utility.growArray(rgobjEnable, iCount + 1, 8);
                    if (listener.isEnabledListener())
                        rgobjEnable[iCount] = Boolean.TRUE;
                    else
                        rgobjEnable[iCount] = Boolean.FALSE;
                    listener.setEnabledListener(bEnable);
                }
                else
                {   // Enable
                    boolean bEnableThis = true;
                    if (iCount < rgobjEnable.length)
                        if (rgobjEnable[iCount] != null)
                            bEnableThis = ((Boolean)rgobjEnable[iCount]).booleanValue();
                    listener.setEnabledListener(bEnableThis);
                }
                iCount++;
            }
            listener = (FileListener)listener.getNextListener();
        }
        if (bEnable)
        {
            if (bAfterRequery)
                this.handleRecordChange(null, DBConstants.AFTER_REQUERY_TYPE, true);
            if (bBreak)
                this.handleRecordChange(null, DBConstants.CONTROL_BREAK_TYPE, true);
            if (bHasNext)
            {
                this.handleValidRecord(true);
                this.handleRecordChange(null, DBConstants.MOVE_NEXT_TYPE, true);
            }
            if (bSelectEOF)
                this.handleRecordChange(null, DBConstants.SELECT_EOF_TYPE, true);
            if (this.getTable().getCurrentTable().getRecord() != this)
            {   // Special logic - match listeners on current record (if shared)
                boolean bCloneListeners = false;
                boolean bMatchEnabledState = true;
                boolean bSyncReferenceFields = false;
                boolean bMatchSelectedState = true;
                this.matchListeners(this.getTable().getCurrentTable().getRecord(), bCloneListeners, bMatchEnabledState, bSyncReferenceFields, bMatchSelectedState, true);
            }
        }
            
        return rgobjEnable;
    }
878554
@RestrictTo(LIBRARY)
	public void notifyFinishedUseCase(UseCaseListener listener) {
		try {
			LOGGER.debug("Notifying " + getClass().getSimpleName() + " finish to listener " + listener.getClass().getSimpleName());
			listener.onFinishUseCase();
		} catch (Exception e) {
			AbstractException abstractException = wrapException(e);
			logHandledException(abstractException);
		}
	}
33396
@Override
  public void handleNotification(Notification notification, Object handback) {
    LocalGossipMember deadMember = (LocalGossipMember) notification.getUserData();
    GossipService.LOGGER.debug("Dead member detected: " + deadMember);
    members.put(deadMember, GossipState.DOWN);
    if (listener != null) {
      listener.gossipEvent(deadMember, GossipState.DOWN);
    }
  }
127419
private void addNotificationListener(ObjectName objectName, final String correlationKey, MBeanServerConnection serverConnection) {
        try {
            notificationListener = new NotificationListener() {
                @Override
                public void handleNotification(Notification notification, Object handback) {
                    correlationManager.store(correlationKey, new DefaultMessage(notification.getMessage()));
                }
            };

            serverConnection.addNotificationListener(objectName, notificationListener, getEndpointConfiguration().getNotificationFilter(), getEndpointConfiguration().getNotificationHandback());
        } catch (InstanceNotFoundException e) {
            throw new CitrusRuntimeException("Failed to find object name instance", e);
        } catch (IOException e) {
            throw new CitrusRuntimeException("Failed to add notification listener", e);
        }
    }
248052
protected void notifyListener(final ExecutorService executor,
    final Future<?> future, final GenericCompletionListener listener) {
    executor.submit(new Runnable() {
      @Override
      public void run() {
        try {
          listener.onComplete(future);
        } catch(Throwable t) {
          getLogger().warn(
            "Exception thrown wile executing " + listener.getClass().getName()
              + ".operationComplete()", t);
        }
      }
    });
  }
360106
public void removeAllListeners(RESTRequest request, ObjectName source_objName, JSONConverter converter) {
        NotificationTargetInformation nti = toNotificationTargetInformation(request, source_objName.getCanonicalName());

        //Get the corresponding List for the given ObjectName
        List<ServerNotification> notifications = serverNotifications.get(nti);

        if (notifications == null) {
            throw ErrorHelper.createRESTHandlerJsonException(new ListenerNotFoundException("There are no listeners registered for ObjectName: " + source_objName.getCanonicalName()),
                                                             converter,
                                                             APIConstants.STATUS_BAD_REQUEST);
        }

        Iterator<ServerNotification> notificationsIter = notifications.iterator();
        while (notificationsIter.hasNext()) {
            ServerNotification currentRegistration = notificationsIter.next();

            if (nti.getRoutingInformation() == null) {
                //Remove from MBeanServer               
                MBeanServerHelper.removeServerNotification(source_objName, //no need to make another ObjectName
                                                           currentRegistration.listener,
                                                           (NotificationFilter) getObject(currentRegistration.filter, null, converter),
                                                           getObject(currentRegistration.handback, null, converter),
                                                           converter);
            } else {
                // Remove the notification listener from the Target-Client Manager through EventAdmin
                MBeanRoutedNotificationHelper helper = MBeanRoutedNotificationHelper.getMBeanRoutedNotificationHelper();
                helper.removeRoutedServerNotificationListener(nti,
                                                              currentRegistration.listener,
                                                              (NotificationFilter) getObject(currentRegistration.filter, null, converter),
                                                              getObject(currentRegistration.handback, null, converter),
                                                              converter);
            }
            //Remove from local list (through iterator)
            notificationsIter.remove();

            //Clean up library
            removeObject(currentRegistration.filter);
            removeObject(currentRegistration.handback);
        }
    }
59225
def notify_listeners(self, msg_type, params):
        """"""
        for c in self.listeners:
            c.notify(msg_type, params)
1082951
protected void unregisterNotificationListeners(ClassLoaderLeakPreventor preventor, NotificationBroadcasterSupport mBean,
                                                 final Class<?> listenerWrapperClass) {
    final Field listenerListField = preventor.findField(NotificationBroadcasterSupport.class, "listenerList");
    if(listenerListField != null) {
      final Class<?> listenerInfoClass = preventor.findClass("javax.management.NotificationBroadcasterSupport$ListenerInfo");

      final List<? /*javax.management.NotificationBroadcasterSupport.ListenerInfo*/> listenerList =
          preventor.getFieldValue(listenerListField, mBean);

      if(listenerList != null) {
        final Field listenerField = preventor.findField(listenerInfoClass, "listener");
        final Field filterField = preventor.findField(listenerInfoClass, "filter");
        final Field handbackField = preventor.findField(listenerInfoClass, "handback");
        for(Object listenerInfo : listenerList) {
          final NotificationListener listener = preventor.getFieldValue(listenerField, listenerInfo);
          final NotificationListener rawListener = unwrap(preventor, listenerWrapperClass, listener);
          final NotificationFilter filter = preventor.getFieldValue(filterField, listenerInfo);
          final Object handback = preventor.getFieldValue(handbackField, listenerInfo);
          
          if(preventor.isLoadedInClassLoader(rawListener) || preventor.isLoadedInClassLoader(filter) || preventor.isLoadedInClassLoader(handback)) {
            preventor.warn(((listener == rawListener) ? "Listener '" : "Wrapped listener '") + listener + 
                "' (or its filter or handback) of MBean " + mBean + 
                " was loaded in protected ClassLoader; removing");
            // This is safe, as the implementation works with a copy, not altering the original
            try {
              mBean.removeNotificationListener(listener, filter, handback);
            }
            catch (ListenerNotFoundException e) { // Should never happen
              preventor.error(e);
            }
          }
        }
      }
    }
  }
365679
private function hook_callback( $listener, $is_filter ) {

		return function () use ( $listener, $is_filter ) {

			$args = func_get_args();

			if ( ! $is_filter ) {
				$log = $listener->update( $args );
				if ( $log instanceof LogDataInterface ) {
					// Log the update result.
					do_action( \Inpsyde\Wonolog\LOG, $log );
				}
			}

			return $is_filter ? $listener->filter( $args ) : NULL;
		};
	}
452648
@Override
    public void handleNotification(Notification notification, Object handback) {
        String notificationType = notification.getType();
        if (notificationType.equals(JMXConnectionNotification.OPENED)) {
            managementContext.incrementManagementSessionCount();
        } else if (notificationType.equals(JMXConnectionNotification.CLOSED)) {
            managementContext.decrementManagementSessionCount();
        }
    }
1350270
@Override
	public int filterObject(CaptureSearchResult r) {
		if(!notifiedSeen) { 
			if(filterGroup != null) {
				filterGroup.setSawAdministrative();
			}
			notifiedSeen = true;
		}
		String surt;
		try {
			String url = canonicalizer.urlStringToKey(r.getOriginalUrl());
			surt = SURT.fromPlain(url);
//			surt = SURTTokenizer.prefixKey(url);
		} catch (URIException e) {
			
			//e.printStackTrace();
			return FILTER_EXCLUDE;
		}
		if(lastChecked != null) {
			if(lastChecked.equals(surt)) {
				if(lastCheckedExcluded) { 
					return ObjectFilter.FILTER_EXCLUDE;
				} else {
					// don't need to: already did last time...
					//filterGroup.setPassedAdministrative();
					return ObjectFilter.FILTER_INCLUDE;
				}
			}
		}
		lastChecked = surt;
		lastCheckedExcluded = isExcluded(surt);
		if(lastCheckedExcluded) {
			return ObjectFilter.FILTER_EXCLUDE;
		} else {
			if(!notifiedPassed) {
				if(filterGroup != null) {
					filterGroup.setPassedAdministrative();
				}
				notifiedPassed = true;
			}
			return ObjectFilter.FILTER_INCLUDE;
		}
			
	}