-
Notifications
You must be signed in to change notification settings - Fork 902
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
Allow registering callbacks when propagating a ServiceInvocationConte… #125
Conversation
cc @synk |
} | ||
} | ||
}; | ||
} | ||
|
||
private static void resetContext(ServiceInvocationContext ctx) { | ||
removeCurrent(); | ||
ctx.makeContextAwareHandlers.forEach(MakeContextAwareHandler::exit); |
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.
makeContextAwareHandlers
seems nullable?
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 - added test too.
return true; | ||
}); | ||
} | ||
|
||
public void addMakeContextAwareHandler(Runnable onContextEnter, Runnable onContextExit) { | ||
if (makeContextAwareHandlers == null) { | ||
makeContextAwareHandlers = new ArrayList<>(); |
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.
initial capacity
Updated to use two lists |
…xt and set them for tracing.
…xt and set them for tracing.
In fully asynchronous servers, it is common to jump in and out of the execution thread, and we need to restore ThreadLocal state every time this happens. We have the makeContextAware family of methods to restore ServiceInvocationContext, but for tracing we also need to restore the ServerSpan.