-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
Description
Describe the bug
A simple demo use -javaagent with 1.15.0 version.
@Slf4j
@Component
public class EventBusPublisher {
AsyncEventBus asyncEventBus;
private ExecutorService pool = Executors.newFixedThreadPool(10);
private AsyncCall asyncCall;
public void publish(Integer number) {
asyncEventBus.post(number);
}
Other class:
@Subscribe
public void listenInteger(Integer param) {
//use api get TraceId
log.info("listenInteger:{}, {}", param, Span.current().getSpanContext().getTraceId());
}
Steps to reproduce
eventBusPublisher.publish(1);
Can't get TraceId
in subscribe method.
But I can get TraceId
in normal executor.execute()
this.eventBusPublisher.getPool().execute(new Runnable() {
public void run() {
log.info("call:{}, {}", i, Span.current().getSpanContext().getTraceId());
}
});
I have got the code in guava , It's also use the same class and method executor.execute(
.
final void dispatchEvent(final Object event) {
this.executor.execute(new Runnable() {
public void run() {
try {
Subscriber.this.invokeSubscriberMethod(event);
} catch (InvocationTargetException var2) {
Subscriber.this.bus.handleSubscriberException(var2.getCause(), Subscriber.this.context(event));
}
}
});
}
What did you expect to see?
A clear and concise description of what you expected to see.
Why i get different result.
What did you see instead?
A clear and concise description of what you saw instead.
What version are you using?
(e.g., v1.15.0
, ``, etc)
Environment
Compiler: (e.g., "AdoptOpenJDK 11.0.6")
OS: (e.g., "MacOS")
Runtime (if different from JDK above): (e.g., "Oracle JRE 8u251")