-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
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
review时的一些疑惑 #428
Comments
要了解这个,逻辑会有点深:jvm-sandbox是怎么做到自己不观察到自己的? 这里核心的魔法使Spy.SelfCallBarrier,在Barrier保护区域之内的类都是可以被jvm-sandbox进行字节码增强观察的,但Barrier之外的类,则会引起递归死循环。所以整个Spy都在尽力自己实现所有使用到的Java类,尽量减少对其他类的使用。当前还有 SandboxProtector的确是很高效的一个重入守护设计,但他是通过ThreadLocal来实现的。在jvm-sandbox的淘宝应用场景中有直接对ThreadLocal进行增强观测的需求,但SandboxProtector由ThreadLocal实现的特性导致了自己将会观察到自己。 |
如果只是因为需要观测ThreadLocal所导致的循环的话, 那么是否可以对 SandboxProtector中的ThreadLocal进行继承,进行国产化,然后再spy入口排除掉SandboxProtector中的ThreadLocal这个对象所进行的操作呢,我可以这样理解吗 |
不可以,继承ThreadLocal不能叫国产化,这个和“汉芯”磨皮有得一拼。 |
不哈意思,我对所谓"国产化"理解存在误区。 |
继承来的类,你底层还是得通过 |
是否可以定制一个Thread实现类似ThreadLocal的功能,比如定义一个context,现有的ThreadLocal感觉并不是太好用,需要显式定义还需要手动清理。 |
SelfCallBarrier.isEnter这个在系统cpu较高时(cpu>50%),性能急剧下降。如果不需要观察 threadlocal, 感觉可以去掉。 |
@Aresxue 有么?有实现了的么,借我“磨皮”下 |
@xl1605368195 就算不观察ThreadLocal也去不掉呀 |
The text was updated successfully, but these errors were encountered: