protected Object createObject() throws SAXException { return new NotificationResult(earliestSequenceNumber, nextSequenceNumber, targetedNotifications); } }
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(); }
/** * 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); } }
TargetedNotification[] tns = nr.getTargetedNotifications(); NotificationResult trialnr = new NotificationResult(0, 0, new TargetedNotification[] { tn }); try { serialization.wrap(trialnr); trialnr = new NotificationResult(0, 0, new TargetedNotification[] { tn }); try { serialization.wrap(trialnr); return new NotificationResult(nr.getEarliestSequenceNumber(), nr.getNextSequenceNumber(), tns);
try { final NotificationResult nr = fetchNotifs(-1, 0, 0); clientSequenceNumber = nr.getNextSequenceNumber(); } catch (final ClassNotFoundException e) { logger.warning("init", "Impossible exception: " + e);
if (startSequenceNumber < 0 || isDisposed()) { synchronized (this) { return new NotificationResult(earliestSequenceNumber(), nextSequenceNumber(), new TargetedNotification[0]); return new NotificationResult(earliestSequenceNumber(), nextSequenceNumber(), new TargetedNotification[0]); final NotificationResult nr = new NotificationResult(earliestSeq, nextSeq, resultNotifs); if (log.debugOn()) log.debug("fetchNotifications", nr.toString()); log.trace("fetchNotifications", "ends"); return nr;
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);
startSequenceNumber = nr.getNextSequenceNumber(); try {
if (result != null) long nextSequence = result.getNextSequenceNumber(); TargetedNotification[] targeted = result.getTargetedNotifications(); int targetedLength = targeted == null ? 0 : targeted.length; boolean notifsFilteredByServer = nextSequence - sequence != targetedLength; boolean notifsLostByServer = sequence >= 0 && result.getEarliestSequenceNumber() > sequence; if (notifsFilteredByServer) handler.sendNotificationsLost(result.getEarliestSequenceNumber() - sequence);
TargetedNotification[] targetedNotifications = (TargetedNotification[]) fetchedNotifications.toArray(new TargetedNotification[fetchedNotifications.size()]); result = new NotificationResult(clientSequenceNumber, currentSequence, targetedNotifications);
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; long missed = 0; 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));
/** * * @param startSequenceNumber . * @param timeout . * @param maxNotifications . * @return . */ public NotificationResult fetchNotifs(final long startSequenceNumber, final long timeout, final int maxNotifications) { if (logger.traceOn()) logger.trace("fetchNotifs", "Fetching notifications, the " + "startSequenceNumber is " + startSequenceNumber + ", the timeout is " + timeout + ", the maxNotifications is " + maxNotifications); NotificationResult nr = null; final long t = Math.min(connectionTimeout, timeout); try { nr = notifBuffer.fetchNotifications(listenerList, startSequenceNumber, t, maxNotifications); } catch (@SuppressWarnings("unused") final InterruptedException ire) { nr = new NotificationResult(0L, 0L, new TargetedNotification[0]); } if (logger.traceOn())logger.trace("fetchNotifs", "Forwarding the notifs: " + nr); return nr; }
result = new NotificationResult(getFirstSequenceNumber(), sequence, new TargetedNotification[0]); RmiConnectorActivator.log(LogService.LOG_DEBUG,"First fetchNotification call: " + this + ", returning " + result, null); result = new NotificationResult(getFirstSequenceNumber(), sequenceNumber + size, notifications); RmiConnectorActivator.log(LogService.LOG_DEBUG,"Non-first fetchNotification call: " + this + ", returning " + result, null);