-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ensures reactor is backward compatible with latest context propagation changes #3493
Conversation
…n changes Signed-off-by: OlegDokuka <odokuka@vmware.com>
Signed-off-by: OlegDokuka <odokuka@vmware.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking care of the backwards compatibility. I think we need to handle non-automatic mode differently and use the ContextSnapshot.setAllThreadLocals call directly instead of ContextPropagationl.setThreadLocals.
} | ||
|
||
@SuppressWarnings("unchecked") | ||
static <C> ContextSnapshot.Scope setThreadLocals(Object context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method can't be used when automatic context propagation is not enabled - every handle/tap setThreadLocal call did behave differently with regard to missing values - with this change it would clear ThreadLocals for values missing in the context, which is not the case in 3.5.6.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right! Good catchup! My bad missed that pice! Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Signed-off-by: OlegDokuka <odokuka@vmware.com>
Signed-off-by: OlegDokuka <odokuka@vmware.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. However, while use of ContextSnapshotFactory
is protected with classpath checks, having it as a static variable leaves it open to potential classpath issues, e.g. some debugger introspecting variables and running into classpath issues it does not expect.
To really isolate the dependency, you could create an internal (private) interface to capture, set thread locals, etc. Then have one implementation for 1.0.3 and another for the existing code. Similar to the SignalListener
implementations but behind a private interface.
On the other hand, I expect all these changes to be relatively short-lived. They are only there to cushion the transition to the next maintenance release, and not long after can be phased out. In light of that, the current changes may be good enough for a brief transition period.
followup to #3489
this PR incorporates old changes with the new ones so it makes the reactor backward compatible with context-propagation libs <= 1.0.2