且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

AIR书面申请使用需要单身产卵应用程序的多个实例

更新时间:2023-11-22 20:43:34

有几种不同的选择:

  1. 在加载每个应用程序实例到它自己的的ApplicationDomain
  2. 使用一个依赖注入框架,你不要T获得单 - 而不是这个它的值分配给在运行的类属性。所有的东西是由元数据管理。这将需要一些code的变化。
  3. 在重构你的code,使每个类的实例会知道它的背景。这可以通过添加一个构造函数的参数或 setContext实施(价值:上下文)功能。 上下文实例会包含链接到所有你的前单身。
  4. 转到了显示列表,直到你找到一些类实例,可以提供你的前单身的链接。确保每个非显示列表对象有一个链接到显示列表对象来获取单身了。
  1. Load each application instance into it's own ApplicationDomain
  2. Use one of the dependency injection frameworks where you don't get the singleton - instead of this it's value is assigned to your class property in runtime. All the stuff is managed by the metadata. It would require some code changes.
  3. Refactor your code so that each class instance would know it's context. This can be implementing by adding a constructor parameter or setContext(value:Context) function. Context instance will contain links to all your ex-singletons.
  4. Go up the display list until you find some class instance that can provide you the links to ex-singletons. Make sure that each non-display-list object has a link to display list object to get singletons too.