4. jvm-sandbox之调用方式(命令行和http)

jvm-sandbox提供两种调用module的方式,命令行和http,下面整理了一些样例(基于https://www.cnblogs.com/moonpool/p/14510129.html)

 

注意:

l  4274:是目标进程的PID

l  37710:是sandbox服务端口,用于接受http请求。

l  mocktest:是nameSpace。命令行中必须同时指定PID和nameSpace。http请求中只需要nameSpace。

l  sumModule/changeSum:是具体的增强方法

l  sumModule:是模块名称,也是id。

下面的http请求,使用时需要加上ip和端口

1.   启动changeSum

  • 命令行:

./sandbox.sh -p 4274 -P 37710 -n mocktest -d sumModule/changeSum

  • http:只是用于启动增强方法

GET /sandbox/mocktest/module/http/sumModule/changeSum

查看mocktest下模块sumModule信息

  • 命令行:

./sandbox.sh -p 4274 -n mocktest -m sumModule

 

  • http:

GET /sandbox/mocktest/module/http/sandbox-module-mgr/detail?1=1&id=sumModule

3.   冻结mocktest下模块sumModule

  • 命令行:

./sandbox.sh -p 4274 -n mocktest -A sumModule

  • http:

GET /sandbox/mocktest/module/http/sandbox-module-mgr/frozen?1=1&ids=sumModule

4.   激活mocktest下模块sumModule

  • 命令行:

./sandbox.sh -p 4274 -n mocktest -a sumModule

 

 

  • http:

GET /sandbox/mocktest/module/http/sandbox-module-mgr/active?1=1&ids=sumModule

5.   卸载mocktest下模块sumModule

  • 命令行:

./sandbox.sh -p 4274 -n mocktest -u sumModule

 

 

  • http:

GET /sandbox/mocktest/module/http/sandbox-module-mgr/unload?1=1&action=unload&ids=sumModule

6.   在mocktest下重新加载所有模块(注意增强类方法不会启动,需要重新启动)

  • 命令行:

./sandbox.sh -p 4274 -n mocktest -R

 

  • http:

GET /sandbox/mocktest/module/http/sandbox-module-mgr/reset?1=1

7.   查看mocktest下加载模块信息

  • 命令行:

./sandbox.sh -p 4274 -n mocktest -l

 

 

  • http:

GET /sandbox/mocktest/module/http/sandbox-module-mgr/list?1=1

8.   查看mocktest下版本信息

  • 命令行:

./sandbox.sh -p 4274 -n mocktest -v

 

  • http:

GET /sandbox/mocktest/module/http/sandbox-info/version?1=1

9.   在mocktest下重新加载用户模块

  • 命令行:

./sandbox.sh -p 4274 -n mocktest -f

 

 

  • http:

GET /sandbox/mocktest/module/http/sandbox-module-mgr/flush?1=1&force=false

 

10.   关闭sandbox

  • 命令行:

./sandbox.sh -p 4274 -n mocktest -S

 

 

  • http:

GET /sandbox/mocktest/module/http/sandbox-control/shutdown?1=1

 

posted @ 2021-03-10 13:43  月色深潭  阅读(2253)  评论(2编辑  收藏  举报