Handle very early completion notification
On a Servlet container a completion notification may come at any time even in the UNSUBSCRIBED state, i.e. before the write Publisher has called onSubscribe. See: gh-23553
This commit is contained in:
parent
07b0fa132e
commit
b7eaab4c5d
|
|
@ -246,6 +246,17 @@ public abstract class AbstractListenerWriteFlushProcessor<T> implements Processo
|
|||
super.onSubscribe(processor, subscription);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void onComplete(AbstractListenerWriteFlushProcessor<T> processor) {
|
||||
// This can happen on (very early) completion notification from container..
|
||||
if (processor.changeState(this, COMPLETED)) {
|
||||
processor.resultPublisher.publishComplete();
|
||||
}
|
||||
else {
|
||||
processor.state.get().onComplete(processor);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
REQUESTED {
|
||||
|
|
|
|||
|
|
@ -322,6 +322,12 @@ public abstract class AbstractListenerWriteProcessor<T> implements Processor<T,
|
|||
super.onSubscribe(processor, subscription);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void onComplete(AbstractListenerWriteProcessor<T> processor) {
|
||||
// This can happen on (very early) completion notification from container..
|
||||
processor.changeStateToComplete(this);
|
||||
}
|
||||
},
|
||||
|
||||
REQUESTED {
|
||||
|
|
|
|||
Loading…
Reference in New Issue