yaojingguo commented on issue #6456:
URL: https://github.com/apache/skywalking/issues/6456#issuecomment-786999002
I have one question about the following code:
```java
public class CallbackConstructorInterceptor implements
InstanceConstructorInterceptor {
@Override
public void onConstruct(EnhancedInstance objInst, Object[] allArguments)
{
Callback callback = (Callback) allArguments[0];
CallbackCache cache;
if (null != objInst.getSkyWalkingDynamicField()) {
cache = (CallbackCache) objInst.getSkyWalkingDynamicField();
} else {
cache = new CallbackCache();
}
cache.setCallback(callback);
objInst.setSkyWalkingDynamicField(cache);
}
}
```
In `KafkaTemplateCallbackInstrumentation`, `CallbackConstructorInterceptor`
is registerred as constructor interceptor for
`org.apache.kafka.clients.producer.KafkaProducer$InterceptorCallback`. Since
`onConstruct` is called after `KafkaProducer$InterceptorCallback`'s origin
constructor invocation, I think that `objInst.getSkyWalkingDynamicField()`
always return `null`.
Under what conditions `objInst.getSkyWalkingDynamicField()` is not `null`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]