@Override public Boolean call(ChangeNotification<?> notification) { return notification.isDataNotification(); } };
private static <T> void collapse(List<ChangeNotification<T>> notifications, Map<T, Integer> markers, List<ChangeNotification<T>> result) { for (int i = notifications.size() - 1; i >= 0; i--) { ChangeNotification<T> next = notifications.get(i); if(next.isDataNotification()) { T data = next.getData(); if (markers.keySet().contains(data)) { int idx = markers.get(data); if (next.getKind() == Kind.Add && result.get(idx).getKind() == Kind.Modify) { result.set(idx, next); } } else { markers.put(data, result.size()); result.add(next); } } } } }
@Override public void onNext(ChangeNotification<InstanceInfo> notification) { if (notification.isDataNotification() && interest.matches(notification.getData())) { notificationTracker.verifyWithExpectations(notification); logger.debug("Notification={}", notification); } } });
@Override public void onNext(ChangeNotification<InstanceInfo> notification) { if (notification.isDataNotification() && interest.matches(notification.getData())) { finalSubject.onNext(notification); } } });
protected Observable<Void> handleChangeNotification(ChangeNotification<InstanceInfo> notification) { if (notification.isDataNotification()) { metrics.incrementApplicationNotificationCounter(notification.getData().getApp()); } Observable<Void> sendResult = sendNotification(notification); if (sendResult != null) { return subscribeToTransportSend(sendResult, "notification"); } else { // TODO: how to report effectively invariant violations that should never happen in a valid code, but are not errors? logger.warn("No-effect modify in the interest channel: {}", notification); return Observable.empty(); } }