in mobius-extras/src/main/java/com/spotify/mobius/extras/QueueingEventSubject.java [80:98]
public void accept(E value) {
Consumer<E> consumerToInvoke = null;
// avoid calling the consumer from the synchronized section
synchronized (this) {
switch (state) {
case NO_SUBSCRIBER:
queue.add(value);
break;
case SUBSCRIBED:
consumerToInvoke = subscriber;
break;
}
}
if (consumerToInvoke != null) {
consumerToInvoke.accept(value);
}
}