@Override public Source getSource() { if (delegate instanceof Sourced) { return ((Sourced) delegate).getSource(); } return null; } }
private static ChangeNotification<InstanceInfo> processNext(ChangeNotification<InstanceInfo> current, ChangeNotification<InstanceInfo> update) { switch (update.getKind()) { case Add: // Add flushes previous state return update; case Modify: // Re-write as add if (current == null) { logger.info("Invalid change notification sequence - " + "'Modify' ChangeNotification without proceeding 'Add' notification;" + "for client view consistency converted to 'Add': {}", update ); } if (update instanceof Sourced) { return new SourcedChangeNotification<>(Kind.Add, update.getData(), ((Sourced) update).getSource()); } else { return new ChangeNotification<>(Kind.Add, update.getData()); } } return null; } }