/** * The action to be performed by this timer task. */ public void run() { try { NotificationResult result = connection.fetchNotifications(clientSequenceNumber, maxNotifications, fetchTimeout); if(result != null) { clientSequenceNumber = result.getNextSequenceNumber(); TargetedNotification[] targetedNotifications = result.getTargetedNotifications(); if(targetedNotifications != null) { deliverNotifications(targetedNotifications); } } else { log.error("Fetched notifications and result was null."); } } catch(IOException e) { log.error("Error fetching notifications for sequence number " + clientSequenceNumber, e); } }
public void serialize(QName name, Attributes attributes, Object value, SerializationContext context) throws IOException { NotificationResult notificationResult = (NotificationResult)value; context.startElement(name, attributes); context.serialize(EARLIEST_NUMBER_QNAME, null, new Long(notificationResult.getEarliestSequenceNumber())); context.serialize(NEXT_NUMBER_QNAME, null, new Long(notificationResult.getNextSequenceNumber())); context.serialize(NOTIFICATIONS_QNAME, null, notificationResult.getTargetedNotifications()); context.endElement(); }
final NotificationResult nr = fetchNotifs(); if (nr == null) break; // nr == null means got exception final TargetedNotification[] notifs = nr.getTargetedNotifications(); final int len = notifs.length; final Map<Integer, ListenerInfo> listeners;
if (log.debugOn()) log.debug("fetchNotifications", "purgeUponFetch=%b", purgeUponFetch); if (purgeUponFetch) { final Set<Notification> notifs = new HashSet<>(nr.getTargetedNotifications().length); for (final TargetedNotification targetdNotif: nr.getTargetedNotifications()) { final Notification notif = targetdNotif.getNotification(); if (!notifs.contains(notif)) notifs.add(notif);
TargetedNotification[] targeted = result.getTargetedNotifications(); int targetedLength = targeted == null ? 0 : targeted.length; boolean notifsFilteredByServer = nextSequence - sequence != targetedLength;
TargetedNotification[] tns = nr.getTargetedNotifications();