protected Object createObject() throws SAXException { return new TargetedNotification(notification, listenerID); } }
private void addClientNotification(Integer id, Notification notification) { synchronized(clientListenerNotifications) { if(clientListenerNotifications.size() == maxNumberOfNotifications) { clientListenerNotifications.remove(0); startSequence++; } TargetedNotification targetedNotification = new TargetedNotification(notification, id); clientListenerNotifications.add(targetedNotification); currentSequence++; } }
private void addNotification(Integer id, Notification notification) { buffer.add(new TargetedNotification(notification, id)); }
final Notification goodNotif = new JMXConnectionNotification(notifType, badNotif.getSource(), clientId, badNotif.getSequenceNumber(), notifMessage, ONE_LONG); tn = new TargetedNotification(goodNotif, listenerID); trialnr = new NotificationResult(0, 0, new TargetedNotification[] { tn }); try {
/** * We have a candidate notification. See if it matches our filters. We do this outside the synchronized block so we don't hold up everyone accessing the buffer * (including notification senders) while we evaluate potentially slow filters. * @param candidate . * @param listeners . * @return . */ private List<TargetedNotification> matchNotifs(final ArrayNotificationBufferAux.NamedNotification candidate, final Set<ListenerInfo> listeners) { final Notification notif = candidate.getNotification(); final List<TargetedNotification> matchedNotifs = new ArrayList<>(); log.debug("fetchNotifications", "applying filters to candidate"); synchronized (listeners) { for (final ListenerInfo li: listeners) { final NotificationFilter filter = li.getNotificationFilter(); if (log.debugOn()) log.debug("fetchNotifications", "pattern=<" + li.getObjectName() + ">; filter=" + filter); if (li.getObjectName().apply(candidate.getObjectName())) { log.debug("fetchNotifications", "pattern matches"); if (filter == null || filter.isNotificationEnabled(notif)) { log.debug("fetchNotifications", "filter matches"); matchedNotifs.add(new TargetedNotification(notif, li.getListenerID())); } } } } return matchedNotifs; }