pinpoint-apm/pinpoint-plugin-sample

Sample12 Async trace AsyncInitiatorInterceptor seems useless

zlp1992 opened this issue · 1 comments

Hi, In Sample12 async trace, it says we should intercept a method initiating an async task and create/record a new AsyncContext, so it intercepts TargetClass12_AsyncInitiator's method asyncHello then intercepts TargetClass12_Worker constructor method to get the AsyncContext passed by AsyncInitiatorInterceptor.
My question is why not create/record a new AsyncContext in the TargetClass12_Worker constructor method interceptor, since TargetClass12_Worker's constructor method is executed in current thread while it's run method executed in another thread, So we can remove AsyncInitiatorInterceptor.

Anyone knows?