启动 JadeGateway 代理时指定代理名称

Specifying the agent name when starting a JadeGateway Agent

我正在尝试做一个 jade Gateway prog。一切正常。除了现在我需要有一种方法来指定网关代理的本地名称。

谁能帮我解决这个问题。

  1. 假设您从命令行启动您的 Jade 代理,jade.Boot 的选项 -agents GW:gateway-agent-class 怎么样(假设您想将您的代理命名为 "GW")
  2. 如果创建 JadeGateway class 或代理 class 的实例,您在为 AgentContainer 实例调用 createNewAgent() 时命名代理。
  3. 如果您使用 JadeGateway.init() 则您只初始化代理。根据 FIPA,INITIALIZED 代理没有名称。代理必须最终达到 ACTIVE 状态才能拥有名称。
  4. 不幸的是,根据 JadeGateway doc:"The activation/termination of this agent (and its underlying container) are completely managed by the JadeGateway class and developers do not need to care about them"。那么没有办法命名 JadeGateway 吗?嗯……反正是单例

这是一篇旧文章 post,但它可能对其他人有所帮助。我还没有找到更改 JadeGateway 代理名称的方法,但可以使用 Profile.CONTAINER_NAME 属性 设置容器名称。它将设置容器名称,创建的网关代理将被命名为"Control"。这样您就可以知道将分配给 JadeGateway 代理的名称。