This change should improve performance of Automatic Context Propagation in certain cases when doOnDiscard, onErrorContinue, and onErrorStop are used.
The context-propagation integration requires contextWrite and tap operators to be barriers for restoring ThreadLocal values. Some internal usage of contextWrite does not require us to treat the operators the same way and we can skip the ceremony of restoring ThreadLocal state as we know that no ThreadLocalAccessor can be registered for them. Therefore, a private variant is introduced to avoid unnecessary overhead when not required.
This change should improve performance of Automatic Context Propagation in certain cases when
doOnDiscard
,onErrorContinue
, andonErrorStop
are used.The context-propagation integration requires
contextWrite
andtap
operators to be barriers for restoringThreadLocal
values. Some internal usage ofcontextWrite
does not require us to treat the operators the same way and we can skip the ceremony of restoringThreadLocal
state as we know that noThreadLocalAccessor
can be registered for them. Therefore, a private variant is introduced to avoid unnecessary overhead when not required.Related #3840