Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to update the ‘List<Greeting>’ while some plugins unloaded and deleted? #62

Open
jeven2016 opened this issue Feb 18, 2021 · 4 comments

Comments

@jeven2016
Copy link

Hi,

Could you take a look at this questions?

Question: How to update the ‘List’ bean while some plugins are unloaded/deleted?

public class Greetings {

  @Autowired
  private List<Greeting> greetings;

  public void printGreetings() {
    System.out.println(String
        .format("Found %d extensions for extension point '%s'", greetings.size(),
            Greeting.class.getName()));
    for (Greeting greeting : greetings) {
      System.out.println(">>> " + greeting.greeting());
    }
  }

}
  1. At the begining, there're 3 extensions found
Found 3 extensions for extension point 'api.Greeting'
>>> custom
>>> Plugin2Greeting
>>> Plugin1Greeting
  1. And I'd like to unload plugin-1 and try to replace it with a new plugin latter
  @GetMapping("uninstall/{pluginId}")
  public Flux<String> uninstall(@PathVariable String pluginId) {
    pluginManager.stopPlugin(pluginId);
    pluginManager.unloadPlugin(pluginId);
    return Flux.just("ok");
  }

  1. unfortunately, there're still be 3 extensions printed after the plugin-1 is unloaded.....

So how to update the bean 'List' during runtime, or any samples illustrate how to integrate with pf4j-update?

Thanks.

@HuangDayu
Copy link

@jeven2016 你好,我也正苦恼这个问题,插件卸载之后,其注入的bean依然可用,除了自主管理bean,还有什么其他更好的办法吗?多个pf4j的衍生版本都存在这个问题。

@jeven2016 Hello, I am also worried about this problem. After the plugin is uninstalled, the bean that is injected is still available. In addition to independent management bean, what other better ways? This problem exists in a derived version of multiple PF4J.

@decebals
Copy link
Member

decebals commented Apr 7, 2021

unfortunately, there're still be 3 extensions printed after the plugin-1 is unloaded.....

I am afraid that here it's necessary a context reload or something similar.

or any samples illustrate how to integrate with pf4j-update?

you can take a look on the readme page of project (https://github.com/pf4j/pf4j-update) or in UpdateIntegrationTest.

@jeven2016
Copy link
Author

@HuangDayu 只有重启才行,我尝试了其他的插件系统,目前还没有这类的多版本运行时升级不重启生效的。

@neasonpy
Copy link

@HuangDayu 只有重启才行,我尝试了其他的插件系统,目前还没有这类的多版本运行时升级不重启生效的。

try SOFA Ark or SOFA Jarlinks to switch multi-version plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants