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

add cache for scan result. (#7477) #8049

Merged
merged 7 commits into from Jun 21, 2021
Merged

add cache for scan result. (#7477) #8049

merged 7 commits into from Jun 21, 2021

Conversation

zhangjiezhang
Copy link
Contributor

@zhangjiezhang zhangjiezhang commented Jun 15, 2021

What is the purpose of the change:
#7477
The method(ServiceClassPostProcessor's registerServiceBeans) is executed to scan the package path twice, so the solution is to add a cache to the scan class(DubboClassPathBeanDefinitionScanner).

@AlbumenJ
Copy link
Member

@kylixs PTAL

Copy link
Member

@kylixs kylixs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove unused method:

public Set<BeanDefinitionHolder> doScan(String... basePackages) {
...
}

@kylixs
Copy link
Member

kylixs commented Jun 15, 2021

Please fix it:

Error: ....DubboClassPathBeanDefinitionScanner.java:19:8: Unused import - org.apache.dubbo.common.utils.CollectionUtils. [UnusedImports]

public Set<BeanDefinition> findCandidateComponents(String basePackage) {
Set<BeanDefinition> beanDefinitions = beanDefinitionMap.get(basePackage);
// if beanDefinitions size ge 0 => don't scan
// if beanDefinitions size is null => scan
Copy link
Member

@kylixs kylixs Jun 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// if beanDefinitions size ge 0 => don't scan

The comment is inaccurate, it is possible that the scan result is empty.
Scan only when the cache is not found.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// if beanDefinitions size ge 0 => don't scan

The comment is inaccurate, it is possible that the scan result is empty.
Scan only when the cache is not found.

beanDefinitions size >= 0, means that the scan has been executed.
Because the result of the scan may be equal to 0, only beanDefinitions is null to scan.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove redundant comments.

@kylixs
Copy link
Member

kylixs commented Jun 16, 2021

Please remove unused method in Dubbo 3.0:

    @Override
    public boolean checkCandidate(String beanName, BeanDefinition beanDefinition) throws IllegalStateException {
        return super.checkCandidate(beanName, beanDefinition);
    }

@kylixs
Copy link
Member

kylixs commented Jun 16, 2021

No description provided.

Please add some description of this pr.

@kylixs
Copy link
Member

kylixs commented Jun 16, 2021

@AlbumenJ AlbumenJ merged commit 96680dd into apache:3.0 Jun 21, 2021
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

3 participants