sofastack / sofa-ark

SOFAArk is a light-weight,java based classloader isolation framework.
https://www.sofastack.tech/projects/sofa-boot/sofa-ark-readme/
Apache License 2.0
1.56k stars 497 forks source link

ArkServiceContainerHolder and ArkServiceContainer should be loaded by the ContainerClassLoader #300

Closed glmapper closed 4 years ago

glmapper commented 4 years ago

现在存在一种情况是,ArkServiceContainerHolder 在setContainer 时,ArkServiceContainerHolder是由 容器类类加载器加载,但是当在子 ark-biz 中使用 ArkServiceContainerHolder 获取 Container 时,ArkServiceContainerHolder 确是由 BizClassLoader 加载,从而导致 获取不到 Container 。

Container 作为 ark 环境整个生命周期中的唯一容器实例,不应该被 biz 所隔离;在 ClassLoaderServiceImpl 的过程中,有对 Ark 自身的类有做特殊处理,但是不彻底。

sofastack-bot[bot] commented 4 years ago

Hi @glmapper, we detect non-English characters in the issue. This comment is an auto translation by @sofastack-robot to help other users to understand this issue.

We encourage you to describe your issue in English which is more friendly to other users.

There is a case where ArkServiceContainerHolder is loaded by the container class class loader when setContainer is set, but when ArkServiceContainerHolder is used to get the container in child ark-biz, ArkServiceContainerHolder is indeed loaded by BizClassLoader, resulting in no Container. Container is the only container instance in the entire life cycle of the ark environment. It should not be isolated by biz. In the process of ClassLoaderServiceImpl, there are special treatments for Ark's own classes, but not completely.

glmapper commented 4 years ago

@straybirdzls @QilongZhang @caojie09

straybirdzls commented 4 years ago

ArkContainer 是很底层的,在 Ark Biz 中不应该感知到 container ,所以的交互形式都以 “服务” 和 “事件“ 处理。不知目前是什么场景需要在 ark biz 中感知 container ?

glmapper commented 4 years ago

yeah