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: can not loop find extension #51

Closed
wants to merge 1 commit into from
Closed

Conversation

acpipe
Copy link

@acpipe acpipe commented Jan 5, 2020

bug 描述

找不到扩展点。
例如扩展点为:

@Extension(bizId = ali)
public class ValidateExt {
      ...
}

COLA框架在extensionRepository中注册的扩展点对应关系为:
ali.defaultUseCase.defaultScenario -> ValidateExt
当身份为: ali.tmall.supermarket 的command执行的时候,找不到该扩展点。
寻找扩展点的逻辑如下:

    /**
     * if the bizScenarioUniqueIdentity is "ali.tmall.supermarket"
     *
     * the search path is as below:
     * 1、first try to get extension by "ali.tmall.supermarket", if get, return it.
     * 2、loop try to get extension by "ali.tmall", if get, return it.
     * 3、loop try to get extension by "ali", if get, return it.
     * 4、if not found, try the default extension
     * @param targetClz
     */

bug fix

有两种办法可以解该Bug。

1.注册循环多条扩展点数据:

ali.defaultUseCase.defaultScenario -> ValidateExt
ali.defaultUseCase -> ValidateExt
ali -> ValidateExt

2. 注册的时候注册

ali -> ValidateExt
寻找扩展点逻辑不变,还是循环寻找扩展点。
最终选择第二种,不违背最开始设计思路,也节省内存中存冗余数据。

@boyangwang
Copy link

This PR should be merged

@CLAassistant
Copy link

CLAassistant commented Mar 4, 2020

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@oldratlee oldratlee force-pushed the master branch 23 times, most recently from fa5ef64 to c9e77a6 Compare January 10, 2021 11:58
@significantfrank
Copy link
Collaborator

已经fix

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.

None yet

4 participants