@Override public ChangeNotification<InstanceInfo> call(StreamStateNotification.BufferState state) { if (state == StreamStateNotification.BufferState.BufferEnd) { return new StreamStateNotification<>(state, interest); } return null; } })
public StreamStateUpdate(StreamStateNotification<InstanceInfo> stateNotification) { this.state = stateNotification.getBufferState(); this.interest = stateNotification.getInterest(); }
public void batchStartFor(InstanceInfo instanceInfo) { for (Entry<Interest, ReplaySubject<ChangeNotification<InstanceInfo>>> entry : notificationSubjects.entrySet()) { if (entry.getKey().matches(instanceInfo)) { entry.getValue().onNext(StreamStateNotification.bufferStartNotification(entry.getKey())); } } }
public void batchEndFor(InstanceInfo instanceInfo) { for (Entry<Interest, ReplaySubject<ChangeNotification<InstanceInfo>>> entry : notificationSubjects.entrySet()) { if (entry.getKey().matches(instanceInfo)) { entry.getValue().onNext(StreamStateNotification.bufferEndNotification(entry.getKey())); } } }
public void batchStart(Interest<InstanceInfo> interest) { getInterestSubject(interest).onNext(StreamStateNotification.bufferStartNotification(interest)); }
public void batchEnd(Interest<InstanceInfo> interest) { getInterestSubject(interest).onNext(StreamStateNotification.bufferEndNotification(interest)); }
public static <T> StreamStateNotification<T> bufferEndNotification(Interest<T> interest) { return new StreamStateNotification<>(BufferState.BufferEnd, interest); } }
public static <T> StreamStateNotification<T> bufferStartNotification(Interest<T> interest) { return new StreamStateNotification<>(BufferState.BufferStart, interest); }
public InstanceInfoInitStateHolder(Iterator<ChangeNotification<InstanceInfo>> initialRegistry, Interest<InstanceInfo> interest) { super(PauseableSubject.<ChangeNotification<InstanceInfo>>create()); this.bufferStartNotification = new StreamStateNotification<>(BufferState.BufferStart, interest); this.bufferEndNotification = new StreamStateNotification<>(BufferState.BufferEnd, interest); notificationMap = new ConcurrentHashMap<>(); while (initialRegistry.hasNext()) { ChangeNotification<InstanceInfo> next = initialRegistry.next(); notificationMap.put(next.getData().getId(), next); // Always Kind.Add } }
private ChangeNotification<InstanceInfo> streamStateUpdateToStreamStateNotification(StreamStateUpdate notification) { BufferState state = notification.getState(); if (state == BufferState.BufferStart || state == BufferState.BufferEnd) { return new StreamStateNotification<InstanceInfo>(state, notification.getInterest()); } throw new IllegalStateException("Unexpected state " + state); }