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

fix:PluginLifeCycleHook postInit() before at addHook() and reduce loop #21

Closed
wants to merge 2 commits into from

Conversation

jujiale
Copy link
Contributor

@jujiale jujiale commented Dec 24, 2023

Description

objectStore.registerCallback(classes, fat.getPluginId());
all.add(fat.getPluginId());
PluginLifeCycleHookManager.addHook(fat.getPluginId());

as the above code, the postInit(pluginId, classes) is ahead of PluginLifeCycleHookManager.addHook(pluginId) , which
result in when invoke postInit, the PluginLifeCycleHook is not ready, so we should fix it.

I use a simple way to fix it, which maybe not the elegant style, If have more elegant style, we should use it

also add some use sample with UserPluginLifeCycleHook

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible

@jujiale jujiale marked this pull request as draft December 24, 2023 14:57
@jujiale jujiale marked this pull request as ready for review December 24, 2023 15:01
@jujiale
Copy link
Contributor Author

jujiale commented Dec 24, 2023

I test the code I submitted in my own env, but github Jave CI with Maven / build(pull_request) is failed in this pr, I checked the progress, the mvn procedure all success, so please determine if it could merge, thanks

@stateIs0
Copy link
Owner

@jujiale PluginLifeCycleHook 在最初的设计里, 是用于拦截“之后安装“的其他插件的,通常是个比较底层的插件,例如拦截之后的所有的 bean 的类上的某个注解 ,可以类比为 spring 容器的钩子;

总而言之,PluginLifeCycleHook 不是用于拦截自己的,如果要拦截自己,可以使用 @PostConstruct 注解。

@jujiale
Copy link
Contributor Author

jujiale commented Dec 25, 2023

@stateIs0 OK, I see,as you said, when plugin will be loaded in later time, the PluginLifeCycleHook has been ready. so this pr should be closed, thanks a lot.

@jujiale jujiale closed this Dec 25, 2023
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

Successfully merging this pull request may close these issues.

2 participants