/** * 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(); }
try { final NotificationResult nr = fetchNotifs(-1, 0, 0); clientSequenceNumber = nr.getNextSequenceNumber(); } catch (final ClassNotFoundException e) { logger.warning("init", "Impossible exception: " + e);
synchronized (forwarder) { if (forwarder.clientSequenceNumber >= 0) missed = nr.getEarliestSequenceNumber() - forwarder.clientSequenceNumber; // check sequence number forwarder.clientSequenceNumber = nr.getNextSequenceNumber(); final int size = forwarder.infoList.size(); listeners = new HashMap<>(((size > len) ? len : size));
if (result != null) long nextSequence = result.getNextSequenceNumber(); TargetedNotification[] targeted = result.getTargetedNotifications(); int targetedLength = targeted == null ? 0 : targeted.length;
return new NotificationResult(nr.getEarliestSequenceNumber(), nr.getNextSequenceNumber(), tns);
startSequenceNumber = nr.getNextSequenceNumber(); try {