koupleless-sofa ark 简记

212 阅读1分钟

安装

class loader 的创建

在 install 新的 biz 模块的时候,将当前 class loader 切换到com.alipay.sofa.ark.container.service.classloader.BizClassLoader。

install 完成之后,将当前class loader恢复。

curl --location --request POST 'localhost:1238/installBiz' \
--header 'Content-Type: application/json' \
--data '{
    "bizName": "biz1",
    "bizVersion": "0.0.1-SNAPSHOT",
    // local path should start with file://, alse support remote url which can be downloaded
    "bizUrl": "file:///Users/hello/IdeaProjects/open_source/koupleless/galaxy/koupless-samples/springboot-samples/web/tomcat/biz1/target/biz1-web-single-host-0.0.1-SNAPSHOT-ark-biz.jar",
    "args": ["hello", "world"],
    "envs": {"hello": "biz1 jvm property"}
}'



curl --location --request POST 'localhost:1238/uninstallBiz' \
--header 'Content-Type: application/json' \
--data '{
    "bizName": "biz1-web-single-host",
    "bizVersion": "0.0.1-SNAPSHOT"
}'



curl --location --request POST 'localhost:1238/installBiz' \
--header 'Content-Type: application/json' \
--data '{
    "bizName": "biz2",
    "bizVersion": "0.0.1-SNAPSHOT",
    // local path should start with file://, alse support remote url which can be downloaded
    "bizUrl": "file:///Users/hello/IdeaProjects/open_source/koupleless/galaxy/koupless-samples/springboot-samples/web/tomcat/biz2/target/biz2-web-single-host-0.0.1-SNAPSHOT-ark-biz.jar",
    "args": ["hello", "world"],
    "envs": {"hello": "biz2 jvm property"}
}'

curl --location --request POST 'localhost:1238/uninstallBiz' \
--header 'Content-Type: application/json' \
--data '{
    "bizName": "biz2-web-single-host",
    "bizVersion": "0.0.1-SNAPSHOT"
}'


curl --location --request POST 'localhost:1238/installBiz' \
--header 'Content-Type: application/json' \
--data '{
    "bizName": "biz2",
    "bizVersion": "0.0.1-SNAPSHOT",
    // local path should start with file://, alse support remote url which can be downloaded
    "bizUrl": "file:///Users/hello/IdeaProjects/open_source/koupleless/galaxy/koupless-samples/springboot-samples/web/tomcat/biz2/target/biz2-web-single-host-0.0.1-SNAPSHOT-ark-biz.jar",
    "args": ["hello", "world"]
}'

卸载

卸载时系统属性的移除

ArkServiceContainer

ArkServiceContainerHolder.setContainer(this);
ArkClient.setBizFactoryService(getService(BizFactoryService.class));
ArkClient.setBizManagerService(getService(BizManagerService.class));
ArkClient.setInjectionService(getService(InjectionService.class));
ArkClient.setEventAdminService(getService(EventAdminService.class));
ArkClient.setPluginManagerService(getService(PluginManagerService.class));
ArkClient.setArguments(arguments);
ArkLoggerFactory.getDefaultLogger().info("Finish to start ArkServiceContainer");

EventAdminService

BizManagerService

参考