Code Monkey home page Code Monkey logo

Comments (5)

shifujun avatar shifujun commented on May 16, 2024 2
git fetch https://github.com/shifujun/Shadow.git issue_56
git checkout -b issue_56 FETCH_HEAD

我在你的提交基础上尝试修复了。

这里有一个设计比较隐晦,我解释一下。PluginManager有两个方向的设计,其中一个方向是怎么管理插件包,另一个方向是怎么供宿主使用。所以宿主这边拿的PluginManager实际上是com.tencent.shadow.dynamic.host.PluginManager接口来使用,实现方实现的是com.tencent.shadow.dynamic.host.PluginManagerImpl接口。而这个实现是跟插件的管理功能没有关系的。和插件管理功能有关系的是com.tencent.shadow.dynamic.manager.PluginManagerThatUseDynamicLoader,这个实现可能不应该实现com.tencent.shadow.dynamic.host.PluginManagerImpl接口,这个我们晚一些再Review一下。PluginManagerThatUseDynamicLoader的实现是持有一个插件进程的Loader去使用。

所以,我的改动,就是让SamplePluginManager不再继承PluginManagerThatUseDynamicLoader,而是直接实现PluginManagerImpl接口,然后持有两个FastPluginManager。

麻烦看一下issue提到的问题是否都解决了。我自行验证是没问题的。

from shadow.

enzowyf avatar enzowyf commented on May 16, 2024

相关问题在这个分支可以观察https://github.com/enzowyf/Shadow.git

from shadow.

shifujun avatar shifujun commented on May 16, 2024

我先看了一下,sample-host打包的两个插件包。如下图,uuid是不一样的。
image
image

uuid不一样的插件不能由同一个Loader加载起来一起工作。如果同一个进程加载了两个插件包的Loader,则会出现PPS出现多实例这样的错误。

在Shadow中也并不是uuid不一样的插件完全不能一起工作。如果两个插件进程加载不一样的uuid的插件包,有各自的Loader,如你的sample一样。两个插件互相是不需要知道对面的进程也是一个插件的,因为Service的Binder都是真的Binder。如果要这样做,可能要对sample的manager进行一些修改。我们目前提供的sample中manager没有管理多个PPS的能力,也没有假设可以同时加载不同uuid的插件。

不能同时管理多个Loader在代码上主要局限在com.tencent.shadow.dynamic.manager.PluginManagerThatUseDynamicLoader#mPluginLoader域变量只持有一个实例,那么它不是插件1的就是插件2的,应该是看先启动的谁。

from shadow.

shifujun avatar shifujun commented on May 16, 2024

首先需要增加这个feature:支持同一个PluginManager实例管理多个插件进程 #57

from shadow.

enzowyf avatar enzowyf commented on May 16, 2024

uuid这个事情我知道,在sample-host的builde.gradle,有个自定义任务genUUID,用于统一uuid,所以应该不是uuid的问题引起的

from shadow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.