@Override public void notificationReceived(List<Notification> notifications) throws IOException { for (Notification notification : notifications) { try { Topic topic = findTopicById(notification.getTopicId()); boolean hasOwner = false; synchronized (optionalListeners) { List<NotificationListener> listeners = optionalListeners.get(topic.getId()); if (listeners != null && !listeners.isEmpty()) { hasOwner = true; notifyListeners(listeners, topic, notification); } } if (!hasOwner) { synchronized (mandatoryListeners) { notifyListeners(mandatoryListeners, topic, notification); } } } catch (UnavailableTopicException ex) { LOG.warn("Received notification for an unknown topic (id={}), exception catched: {}", notification.getTopicId(), ex); } } }
if (clientState.updateTopicSubscriptionInfo(notification.getTopicId(), notification.getSeqNumber())) { newNotifications.add(notification);