We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
询问有关本项目的使用和其他方面的相关问题。
目前反序列化时,在com.alibaba.fastjson2.util.TypeUtils#loadClass里,目前是有Thread.currentThread().getContextClassLoader()这个类加载器来加载类。但是,我目前遇到了一个问题,不能使用这个类加载器,ContextClassLoader在业务里被用来加载另外一个隔离scope的类,而当每次都加载不到的时候,会产生严重的性能问题。
com.alibaba.fastjson2.util.TypeUtils#loadClass
Thread.currentThread().getContextClassLoader()
fastjson2反序列化的时候,会在com.alibaba.fastjson2.reader.ObjectReaderProvider#checkAutoType里调用一次loadClass,但每次都加载不到,因为这个业务自定义classLoader的问题,出现高性能延迟。
com.alibaba.fastjson2.reader.ObjectReaderProvider#checkAutoType
所以希望能只在反序列化前后,把这个自定义的ContextClassLoader替换掉。
除了cglib之外,fastjson2内部是否提供了这样的机制?
整个我需要做类似下面这个事情,但我希望一次性搞定。
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try{ Thread.currentThread().setContextClassLoader(null); JSON.parseObject(json); }finally{ Thread.currentThread().setContextClassLoader(contextClassLoader ); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
请描述您的问题
询问有关本项目的使用和其他方面的相关问题。
目前反序列化时,在
com.alibaba.fastjson2.util.TypeUtils#loadClass
里,目前是有Thread.currentThread().getContextClassLoader()
这个类加载器来加载类。但是,我目前遇到了一个问题,不能使用这个类加载器,ContextClassLoader在业务里被用来加载另外一个隔离scope的类,而当每次都加载不到的时候,会产生严重的性能问题。fastjson2反序列化的时候,会在
com.alibaba.fastjson2.reader.ObjectReaderProvider#checkAutoType
里调用一次loadClass,但每次都加载不到,因为这个业务自定义classLoader的问题,出现高性能延迟。所以希望能只在反序列化前后,把这个自定义的ContextClassLoader替换掉。
除了cglib之外,fastjson2内部是否提供了这样的机制?
整个我需要做类似下面这个事情,但我希望一次性搞定。
The text was updated successfully, but these errors were encountered: