wu-sheng commented on issue #7440:
URL: https://github.com/apache/skywalking/issues/7440#issuecomment-896550583


   The first solution may not work. Because the delegate mechanism only 
supports to do once. 
   
   > Finally, I also looked for new apis in ByteBuddy as an alternative to 
MethodDelegation. but,I am newer for it.This will be a long time.
   
   This should not work, I checked with the author before. 
   
   > I have debugged code, and found the reason is every time a class is 
enhanced, it will delegate the original method to a new InstMethodsInter 
instance. So, the previous is overridden.
   
   Yes, this is the reason. 
   
   You missed one important port, `EnhancedInstance#dynamicField`, which has 
only one value. But different interceptors could access(set/get) with or 
without other plugins. In this case, you will face ·race condition`, 
`visibility of memory operations across threads`, even `type cast exception` in 
the runtime.


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to