Compare commits
1 Commits
3.2
...
dependabot
| Author | SHA1 | Date |
|---|---|---|
|
|
0877c5e2ee |
|
|
@ -1,88 +0,0 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
title: "[General][Java SDK (Component)] xxx"
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
<img src="https://dubbo.apache.org/imgs/nav_logo2.png" alt="Dubbo logo" height="90px" align="right" />
|
||||
|
||||
Thank you for finding the time to share your idea! We really appreciate the community efforts to improve Dubbo.
|
||||
|
||||
If you need to report a security issue, please visit [our security policy](https://github.com/apache/dubbo/security/policy).
|
||||
|
||||
**Dubbo is open for world wide collaboration, please make sure that all the content you provide is in English.**
|
||||
Remember that non-English idea is quite not friendly for everyone, and might unable to get the response!
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Pre-check
|
||||
options:
|
||||
- label: >
|
||||
I am sure that all the content I provide is in English.
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Apache Dubbo Component
|
||||
description: |
|
||||
What Apache Dubbo component are you using? Apache Dubbo has many subprojects, please make sure
|
||||
to choose the component that you want to ask questions about.
|
||||
multiple: false
|
||||
options:
|
||||
- "Java SDK (apache/dubbo)"
|
||||
- "Java Samples (apache/dubbo-samples)"
|
||||
- "Java Integration Cases (apache/dubbo-integration-cases)"
|
||||
- "Java SPI Extensions (apache/dubbo-spi-extensions)"
|
||||
- "Java Benchmark (apache/dubbo-benchmark)"
|
||||
- "Go SDK (apache/dubbo-go)"
|
||||
- "Go Samples (apache/dubbo-go-samples)"
|
||||
- "Rust SDK (apache/dubbo-rust)"
|
||||
- "Node.js SDK (apache/dubbo-js)"
|
||||
- "Python SDK (apache/dubbo-python)"
|
||||
- "Kubernetes Integration (apache/dubbo-kubernetes)"
|
||||
- "Pixiu Gateway (apache/dubbo-go-pixiu)"
|
||||
- "Pixiu Gateway Samples (apache/dubbo-go-pixiu-samples)"
|
||||
- "Admin (apache/dubbo-admin)"
|
||||
- "Website (apache/dubbo-website)"
|
||||
- "Awesome (apache/dubbo-awesome)"
|
||||
- "Initializer (apache/dubbo-intializer)"
|
||||
- "Others (apache/dubbo-xxx)"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Details
|
||||
description: Anything you want to ask?
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Code of Conduct
|
||||
description: The Code of Conduct helps create a safe space for everyone. We require that everyone agrees to it.
|
||||
options:
|
||||
- label: >
|
||||
I agree to follow this project's
|
||||
[Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
||||
required: true
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "Thanks for completing our form!"
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
title: "[Q/A][Java SDK (Component)] xxx"
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
<img src="https://dubbo.apache.org/imgs/nav_logo2.png" alt="Dubbo logo" height="90px" align="right" />
|
||||
|
||||
Thank you for finding the time to report the question! We really appreciate the community efforts to improve Dubbo.
|
||||
|
||||
If you need to report a security issue, please visit [our security policy](https://github.com/apache/dubbo/security/policy).
|
||||
|
||||
**Dubbo is open for world wide collaboration, please make sure that all the content you provide is in English.**
|
||||
Remember that non-English question is quite not friendly for everyone, and might unable to get the response!
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Pre-check
|
||||
options:
|
||||
- label: >
|
||||
I am sure that all the content I provide is in English.
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Apache Dubbo Component
|
||||
description: |
|
||||
What Apache Dubbo component are you using? Apache Dubbo has many subprojects, please make sure
|
||||
to choose the component that you want to ask questions about.
|
||||
multiple: false
|
||||
options:
|
||||
- "Java SDK (apache/dubbo)"
|
||||
- "Java Samples (apache/dubbo-samples)"
|
||||
- "Java Integration Cases (apache/dubbo-integration-cases)"
|
||||
- "Java SPI Extensions (apache/dubbo-spi-extensions)"
|
||||
- "Java Benchmark (apache/dubbo-benchmark)"
|
||||
- "Go SDK (apache/dubbo-go)"
|
||||
- "Go Samples (apache/dubbo-go-samples)"
|
||||
- "Rust SDK (apache/dubbo-rust)"
|
||||
- "Node.js SDK (apache/dubbo-js)"
|
||||
- "Python SDK (apache/dubbo-python)"
|
||||
- "Kubernetes Integration (apache/dubbo-kubernetes)"
|
||||
- "Pixiu Gateway (apache/dubbo-go-pixiu)"
|
||||
- "Pixiu Gateway Samples (apache/dubbo-go-pixiu-samples)"
|
||||
- "Admin (apache/dubbo-admin)"
|
||||
- "Website (apache/dubbo-website)"
|
||||
- "Awesome (apache/dubbo-awesome)"
|
||||
- "Initializer (apache/dubbo-intializer)"
|
||||
- "Others (apache/dubbo-xxx)"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Details
|
||||
description: Anything you want to know?
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Code of Conduct
|
||||
description: The Code of Conduct helps create a safe space for everyone. We require that everyone agrees to it.
|
||||
options:
|
||||
- label: >
|
||||
I agree to follow this project's
|
||||
[Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
||||
required: true
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "Thanks for completing our form!"
|
||||
|
|
@ -1,142 +0,0 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
name: Bug Report
|
||||
description: File a bug report
|
||||
title: "[Bug] "
|
||||
labels: ["type/need-triage", "component/need-triage"]
|
||||
projects: ["apache/337"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
<img src="https://dubbo.apache.org/imgs/nav_logo2.png" alt="Dubbo logo" height="90px" align="right" />
|
||||
|
||||
Thank you for finding the time to report the problem! We really appreciate the community efforts to improve Dubbo.
|
||||
|
||||
Please make sure what you are reporting is indeed a bug with reproducible steps, if you want to ask questions
|
||||
or share ideas, please [subscribe to our mailing list](mailto:dev-subscribe@dubbo.apache.org) and sent
|
||||
emails to [our mailing list](mailto:dev@dubbo.apache.org), you can also head to our
|
||||
[Discussion](https://github.com/apache/dubbo/discussions) tab.
|
||||
|
||||
If you need to report a security issue, please visit [our security policy](https://github.com/apache/dubbo/security/policy).
|
||||
|
||||
**Dubbo is open for world wide collaboration, please make sure that all the content you provide is in English.**
|
||||
Remember that non-English issues is quite not friendly for everyone, and might unable to get the response!
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Pre-check
|
||||
options:
|
||||
- label: >
|
||||
I am sure that all the content I provide is in English.
|
||||
required: true
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Search before asking
|
||||
description: >
|
||||
Please make sure to search in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) first to see
|
||||
whether the same issue was reported already.
|
||||
options:
|
||||
- label: >
|
||||
I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no similar
|
||||
issues.
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Apache Dubbo Component
|
||||
description: |
|
||||
What Apache Dubbo component are you using? Apache Dubbo has many subprojects, please make sure
|
||||
to choose the component that you want to ask questions about.
|
||||
multiple: false
|
||||
options:
|
||||
- "Java SDK (apache/dubbo)"
|
||||
- "Java Samples (apache/dubbo-samples)"
|
||||
- "Java Integration Cases (apache/dubbo-integration-cases)"
|
||||
- "Java SPI Extensions (apache/dubbo-spi-extensions)"
|
||||
- "Java Benchmark (apache/dubbo-benchmark)"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Dubbo Version
|
||||
description: "Which Dubbo version, JDK version and operating system did you use?"
|
||||
placeholder: "Example: Dubbo Java 3.2.12, OpenJDK 1.8, Ubuntu 20.04"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Steps to reproduce this issue
|
||||
description: >
|
||||
Describe how to reproduce this issue.If you are not able to provide a reproducible case,
|
||||
please open a [Discussion](https://github.com/apache/dubbo/discussions) instead.
|
||||
placeholder: >
|
||||
Please provide the context in which the problem occurred and explain what happened.
|
||||
A [GitHub address] would be helpful for maintainers to reproduce the problem.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: What you expected to happen
|
||||
description: What do you think went wrong?
|
||||
placeholder: >
|
||||
Please explain why you think the behaviour is erroneous. It is extremely helpful if you copy and paste
|
||||
the fragment of logs showing the exact error messages or wrong behaviour and screenshots for
|
||||
UI problems. You can include files by dragging and dropping them here.
|
||||
|
||||
**NOTE**: please copy and paste texts instead of taking screenshots of them for easy future search.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Anything else
|
||||
description: Anything else we need to know?
|
||||
placeholder: >
|
||||
How often does this problem occur? (Once? Every time? Only when certain conditions are met?)
|
||||
Any relevant logs to include? Put them here inside fenced
|
||||
``` ``` blocks or inside a collapsable details tag if it's too long:
|
||||
<details><summary>x.log</summary> lots of stuff </details>
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Are you willing to submit a pull request to fix on your own?
|
||||
description: >
|
||||
This is absolutely not required, but we are happy to guide you in the contribution process
|
||||
especially if you already have a good understanding of how to implement the fix.
|
||||
Dubbo is a totally community-driven project and we love to bring new contributors in.
|
||||
options:
|
||||
- label: Yes I am willing to submit a pull request on my own!
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Code of Conduct
|
||||
description: The Code of Conduct helps create a safe space for everyone. We require that everyone agrees to it.
|
||||
options:
|
||||
- label: >
|
||||
I agree to follow this project's
|
||||
[Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
||||
required: true
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "Thanks for completing our form!"
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
name: Feature Request
|
||||
description: Create a Feature Request for Dubbo
|
||||
title: "[Feature] "
|
||||
labels: ["type/need-triage", "component/need-triage"]
|
||||
projects: ["apache/337"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
<img src="https://dubbo.apache.org/imgs/nav_logo2.png" alt="Dubbo logo" height="90px" align="right" />
|
||||
|
||||
Thank you for finding the time to propose new feature!
|
||||
|
||||
We really appreciate the community efforts to improve Dubbo.
|
||||
|
||||
**Dubbo is open for world wide collaboration, please make sure that all the content you provide is in English.**
|
||||
Remember that non-English issues is quite not friendly for everyone, and might unable to get the response!
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Pre-check
|
||||
options:
|
||||
- label: >
|
||||
I am sure that all the content I provide is in English.
|
||||
required: true
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Search before asking
|
||||
description: >
|
||||
Please make sure to search in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) first to see
|
||||
whether the same feature was requested already.
|
||||
options:
|
||||
- label: >
|
||||
I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no similar
|
||||
feature requirement.
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Apache Dubbo Component
|
||||
description: |
|
||||
What Apache Dubbo component are you using? Apache Dubbo has many subprojects, please make sure
|
||||
to choose the component that you want to ask questions about.
|
||||
multiple: false
|
||||
options:
|
||||
- "Java SDK (apache/dubbo)"
|
||||
- "Java Samples (apache/dubbo-samples)"
|
||||
- "Java Integration Cases (apache/dubbo-integration-cases)"
|
||||
- "Java SPI Extensions (apache/dubbo-spi-extensions)"
|
||||
- "Java Benchmark (apache/dubbo-benchmark)"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Descriptions
|
||||
description: A short description of your feature
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Related issues
|
||||
description: Is there currently another issue associated with this?
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Are you willing to submit a pull request to fix on your own?
|
||||
description: >
|
||||
This is absolutely not required, but we are happy to guide you in the contribution process
|
||||
especially if you already have a good understanding of how to implement the feature.
|
||||
Dubbo is a totally community-driven project and we love to bring new contributors in.
|
||||
options:
|
||||
- label: Yes I am willing to submit a pull request on my own!
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Code of Conduct
|
||||
description: The Code of Conduct helps create a safe space for everyone. We require that everyone agrees to it.
|
||||
options:
|
||||
- label: >
|
||||
I agree to follow this project's
|
||||
[Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
||||
required: true
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "Thanks for completing our form!"
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
name: Bug Report
|
||||
about: Report a bug in Dubbo
|
||||
title: ''
|
||||
labels: status/need-triage
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
<!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->
|
||||
|
||||
- [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.
|
||||
|
||||
### Environment
|
||||
|
||||
* Dubbo version: xxx
|
||||
* Operating System version: xxx
|
||||
* Java version: xxx
|
||||
|
||||
### Steps to reproduce this issue
|
||||
|
||||
1. xxx
|
||||
2. xxx
|
||||
3. xxx
|
||||
|
||||
Pls. provide [GitHub address] to reproduce this issue.
|
||||
|
||||
### Expected Behavior
|
||||
|
||||
<!-- What do you expect from the above steps?-->
|
||||
|
||||
### Actual Behavior
|
||||
|
||||
<!-- What actually happens? -->
|
||||
|
||||
If there is an exception, please attach the exception trace:
|
||||
|
||||
```
|
||||
Just put your stack trace here!
|
||||
```
|
||||
|
|
@ -1,22 +1,8 @@
|
|||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
blank_issues_enabled: false
|
||||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
- name: Question & FAQ & Proposal
|
||||
url: https://github.com/apache/dubbo/discussions/
|
||||
about: Ask a question, request support or submit a proposal for Apache Dubbo.
|
||||
- name: Dubbo Community Repo
|
||||
url: https://github.com/apache/dubbo-website
|
||||
about: Please see our community docs here.
|
||||
- name: Report a security issue
|
||||
url: https://github.com/apache/dubbo/security/policy
|
||||
about: Please report security vulnerabilities using these instructions.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
name: Discussion
|
||||
about: Start a discussion for Dubbo
|
||||
title: ''
|
||||
labels: type/discussion
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
<!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->
|
||||
|
||||
<!-- For all design discussions please continue. -->
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
name: Feature Request
|
||||
about: Create a Feature Request for Dubbo
|
||||
title: ''
|
||||
labels: type/feature
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
<!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->
|
||||
|
||||
- [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.
|
||||
- [ ] I have searched the [release notes](https://github.com/apache/dubbo/releases) of this repository and believe that this is not a duplicate.
|
||||
|
||||
## Describe the feature
|
||||
<!-- Please also discuss possible business value -->
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
name: Proposal
|
||||
about: Create a technical proposal for Dubbo
|
||||
title: ''
|
||||
labels: type/proposal
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
<!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->
|
||||
|
||||
- [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.
|
||||
|
||||
## Describe the proposal
|
||||
<!-- Please use this for a concrete design proposal for functionality. -->
|
||||
<!-- If you just want to request a new feature and discuss the possible business value, create a Feature Request. -->
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
name: Question
|
||||
about: Ask a question about Dubbo
|
||||
title: ''
|
||||
labels: type/question
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
<!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->
|
||||
|
||||
- [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.
|
||||
|
||||
## Ask your question here
|
||||
|
|
@ -579,10 +579,10 @@ jobs:
|
|||
|
||||
- name: "Setup Zookeeper environment"
|
||||
run: |
|
||||
wget https://dlcdn.apache.org/zookeeper/zookeeper-3.8.4/apache-zookeeper-3.8.4-bin.tar.gz
|
||||
tar -zxvf apache-zookeeper-3.8.4-bin.tar.gz
|
||||
mv apache-zookeeper-3.8.4-bin/conf/zoo_sample.cfg apache-zookeeper-3.8.4-bin/conf/zoo.cfg
|
||||
apache-zookeeper-3.8.4-bin/bin/zkServer.sh start
|
||||
wget https://dlcdn.apache.org/zookeeper/zookeeper-3.8.3/apache-zookeeper-3.8.3-bin.tar.gz
|
||||
tar -zxvf apache-zookeeper-3.8.3-bin.tar.gz
|
||||
mv apache-zookeeper-3.8.3-bin/conf/zoo_sample.cfg apache-zookeeper-3.8.3-bin/conf/zoo.cfg
|
||||
apache-zookeeper-3.8.3-bin/bin/zkServer.sh start
|
||||
|
||||
- name: "Check environment"
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -477,10 +477,10 @@ jobs:
|
|||
|
||||
- name: "Setup Zookeeper environment"
|
||||
run: |
|
||||
wget https://dlcdn.apache.org/zookeeper/zookeeper-3.8.4/apache-zookeeper-3.8.4-bin.tar.gz
|
||||
tar -zxvf apache-zookeeper-3.8.4-bin.tar.gz
|
||||
mv apache-zookeeper-3.8.4-bin/conf/zoo_sample.cfg apache-zookeeper-3.8.4-bin/conf/zoo.cfg
|
||||
apache-zookeeper-3.8.4-bin/bin/zkServer.sh start
|
||||
wget https://dlcdn.apache.org/zookeeper/zookeeper-3.8.3/apache-zookeeper-3.8.3-bin.tar.gz
|
||||
tar -zxvf apache-zookeeper-3.8.3-bin.tar.gz
|
||||
mv apache-zookeeper-3.8.3-bin/conf/zoo_sample.cfg apache-zookeeper-3.8.3-bin/conf/zoo.cfg
|
||||
apache-zookeeper-3.8.3-bin/bin/zkServer.sh start
|
||||
|
||||
- name: "Check environment"
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -477,10 +477,10 @@ jobs:
|
|||
|
||||
- name: "Setup Zookeeper environment"
|
||||
run: |
|
||||
wget https://dlcdn.apache.org/zookeeper/zookeeper-3.8.4/apache-zookeeper-3.8.4-bin.tar.gz
|
||||
tar -zxvf apache-zookeeper-3.8.4-bin.tar.gz
|
||||
mv apache-zookeeper-3.8.4-bin/conf/zoo_sample.cfg apache-zookeeper-3.8.4-bin/conf/zoo.cfg
|
||||
apache-zookeeper-3.8.4-bin/bin/zkServer.sh start
|
||||
wget https://dlcdn.apache.org/zookeeper/zookeeper-3.8.3/apache-zookeeper-3.8.3-bin.tar.gz
|
||||
tar -zxvf apache-zookeeper-3.8.3-bin.tar.gz
|
||||
mv apache-zookeeper-3.8.3-bin/conf/zoo_sample.cfg apache-zookeeper-3.8.3-bin/conf/zoo.cfg
|
||||
apache-zookeeper-3.8.3-bin/bin/zkServer.sh start
|
||||
|
||||
- name: "Check environment"
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ jobs:
|
|||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'zulu'
|
||||
java-version: 21
|
||||
java-version: 8
|
||||
- uses: actions/cache@v3
|
||||
name: "Cache local Maven repository"
|
||||
with:
|
||||
|
|
@ -477,10 +477,10 @@ jobs:
|
|||
|
||||
- name: "Setup Zookeeper environment"
|
||||
run: |
|
||||
wget https://dlcdn.apache.org/zookeeper/zookeeper-3.8.4/apache-zookeeper-3.8.4-bin.tar.gz
|
||||
tar -zxvf apache-zookeeper-3.8.4-bin.tar.gz
|
||||
mv apache-zookeeper-3.8.4-bin/conf/zoo_sample.cfg apache-zookeeper-3.8.4-bin/conf/zoo.cfg
|
||||
apache-zookeeper-3.8.4-bin/bin/zkServer.sh start
|
||||
wget https://dlcdn.apache.org/zookeeper/zookeeper-3.8.3/apache-zookeeper-3.8.3-bin.tar.gz
|
||||
tar -zxvf apache-zookeeper-3.8.3-bin.tar.gz
|
||||
mv apache-zookeeper-3.8.3-bin/conf/zoo_sample.cfg apache-zookeeper-3.8.3-bin/conf/zoo.cfg
|
||||
apache-zookeeper-3.8.3-bin/bin/zkServer.sh start
|
||||
|
||||
- name: "Check environment"
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -472,10 +472,10 @@ jobs:
|
|||
|
||||
- name: "Setup Zookeeper environment"
|
||||
run: |
|
||||
wget https://dlcdn.apache.org/zookeeper/zookeeper-3.8.4/apache-zookeeper-3.8.4-bin.tar.gz
|
||||
tar -zxvf apache-zookeeper-3.8.4-bin.tar.gz
|
||||
mv apache-zookeeper-3.8.4-bin/conf/zoo_sample.cfg apache-zookeeper-3.8.4-bin/conf/zoo.cfg
|
||||
apache-zookeeper-3.8.4-bin/bin/zkServer.sh start
|
||||
wget https://dlcdn.apache.org/zookeeper/zookeeper-3.8.3/apache-zookeeper-3.8.3-bin.tar.gz
|
||||
tar -zxvf apache-zookeeper-3.8.3-bin.tar.gz
|
||||
mv apache-zookeeper-3.8.3-bin/conf/zoo_sample.cfg apache-zookeeper-3.8.3-bin/conf/zoo.cfg
|
||||
apache-zookeeper-3.8.3-bin/bin/zkServer.sh start
|
||||
|
||||
- name: "Check environment"
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@ target/
|
|||
.settings/
|
||||
.project
|
||||
.classpath
|
||||
.externalToolBuilders
|
||||
maven-eclipse.xml
|
||||
|
||||
# idea ignore
|
||||
.idea/
|
||||
|
|
@ -52,6 +50,3 @@ dubbo-demo/dubbo-demo-triple/build/*
|
|||
|
||||
.git.exec.error
|
||||
|
||||
# log files generated by testcase.
|
||||
dubbo-rpc/dubbo-rpc-api/custom-access.log*
|
||||
|
||||
|
|
|
|||
82
README.md
82
README.md
|
|
@ -6,10 +6,13 @@
|
|||

|
||||
[](http://isitmaintained.com/project/apache/dubbo "Average time to resolve an issue")
|
||||
[](http://isitmaintained.com/project/apache/dubbo "Percentage of issues still open")
|
||||
[](https://twitter.com/intent/tweet?text=Apache%20Dubbo%20is%20a%20high-performance%2C%20java%20based%2C%20open%20source%20RPC%20framework.&url=http://dubbo.apache.org/&via=ApacheDubbo&hashtags=rpc,java,dubbo,micro-service)
|
||||
[](https://twitter.com/intent/follow?screen_name=ApacheDubbo)
|
||||
[](https://gitter.im/alibaba/dubbo?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
|
||||
Apache Dubbo is a high-performance, Java-based open-source RPC framework. Please visit the [official site](http://dubbo.apache.org) for the quick start guide and documentation, as well as the [wiki](https://github.com/apache/dubbo/wiki) for news, FAQ, and release notes.
|
||||
|
||||
We are now collecting Dubbo user info to help us to improve Dubbo further. Kindly support us by providing your usage information on [Wanted: who's using dubbo](https://github.com/apache/dubbo/discussions/13842), thanks :)
|
||||
We are now collecting Dubbo user info to help us to improve Dubbo further. Kindly support us by providing your usage information on [issue#9436: Wanted: who's using dubbo](https://github.com/apache/dubbo/issues/9436), thanks :)
|
||||
|
||||
## Architecture
|
||||
|
||||
|
|
@ -39,7 +42,7 @@ There's a [README](https://github.com/apache/dubbo-samples/blob/389cd612f1ea57ee
|
|||
|
||||
```xml
|
||||
<properties>
|
||||
<dubbo.version>3.2.13-SNAPSHOT</dubbo.version>
|
||||
<dubbo.version>3.2.11</dubbo.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
|
@ -183,55 +186,34 @@ To avoid intermittent test failures (i.e., flaky tests), it is recommended to ha
|
|||
* Minimum of 2CPUs.
|
||||
* Minimum of 2Gb of RAM.
|
||||
|
||||
### How does the Dubbo Community collaborate?
|
||||
## Contact
|
||||
|
||||
The Dubbo Community primarily communicates on GitHub through issues, discussions, and pull requests.
|
||||
* Mailing list:
|
||||
* dev list: for dev/user discussion. [subscribe](mailto:dev-subscribe@dubbo.apache.org), [unsubscribe](mailto:dev-unsubscribe@dubbo.apache.org), [archive](https://lists.apache.org/list.html?dev@dubbo.apache.org), [guide](https://github.com/apache/dubbo/wiki/Mailing-list-subscription-guide)
|
||||
|
||||
- Issues: We use issues to track bugs and tasks. Any **work-related** item is associated with an issue.
|
||||
- Discussions: We use discussions for questions, early proposals, and announcements. Any **idea-related** item is associated with a discussion.
|
||||
- Pull Requests: We use pull requests to merge a set of changes from contributors into Dubbo.
|
||||
* Bugs: [Issues](https://github.com/apache/dubbo/issues/new?template=dubbo-issue-report-template.md)
|
||||
* Gitter: [Gitter channel](https://gitter.im/alibaba/dubbo)
|
||||
* Twitter: [@ApacheDubbo](https://twitter.com/ApacheDubbo)
|
||||
|
||||
We have also implemented [a project board](https://github.com/orgs/apache/projects/337) to monitor all the items.
|
||||
## Contributing
|
||||
|
||||
Any essential changes should be discussed on the mailing list before they happen.
|
||||
See [CONTRIBUTING](https://github.com/apache/dubbo/blob/master/CONTRIBUTING.md) for details on submitting patches and the contribution workflow.
|
||||
|
||||
### Seeking for help
|
||||
### How can I contribute?
|
||||
|
||||
If you have questions such as:
|
||||
|
||||
- What is Dubbo?
|
||||
- How do I use Dubbo?
|
||||
- Why did an unexpected result occur?
|
||||
|
||||
Please start a discussion at https://github.com/apache/dubbo/discussions.
|
||||
|
||||
However, if you encounter the following situations:
|
||||
|
||||
- You're certain there's a bug that Dubbo needs to fix,
|
||||
- You believe a feature could be enhanced,
|
||||
- You have a detailed proposal for improving Dubbo,
|
||||
|
||||
Please open an issue at https://github.com/apache/dubbo/issues.
|
||||
|
||||
To ask effective questions, we recommend reading **[How To Ask Questions The Smart Way](https://github.com/selfteaching/How-To-Ask-Questions-The-Smart-Way/blob/master/How-To-Ask-Questions-The-Smart-Way.md)** first.
|
||||
|
||||
### Contribution
|
||||
|
||||
- Browse the "help wanted" tasks in the [Dubbo project board](https://github.com/orgs/apache/projects/337).
|
||||
- Participate in discussions on the mailing list. See the subscription [guide](https://github.com/apache/dubbo/wiki/Mailing-list-subscription-guide).
|
||||
- Respond to queries in the [discussions](https://github.com/apache/dubbo/issues).
|
||||
- Resolve bugs reported in [issues](https://github.com/apache/dubbo/issues) and send us a pull request.
|
||||
- Review existing [pull requests](https://github.com/apache/dubbo/pulls).
|
||||
- Enhance the [website](https://github.com/apache/dubbo-website). We typically need:
|
||||
- Blog posts
|
||||
- Translations for documentation
|
||||
- Use cases showcasing Dubbo integration in enterprise systems.
|
||||
- Improve the [dubbo-admin](https://github.com/apache/dubbo-admin).
|
||||
- Contribute to the projects listed in the [ecosystem](https://github.com/apache/?q=dubbo&type=all&language=&sort=).
|
||||
- Any other forms of contribution not listed above are also welcome.
|
||||
- If you're interested in contributing, please send an email to [dev@dubbo.apache.org](mailto:dev@dubbo.apache.org) to let us know!
|
||||
|
||||
For further details, please refer our [guide](https://github.com/apache/dubbo/blob/master/CONTRIBUTING.md) about how to contribute Dubbo.
|
||||
* Take a look at issues with tags marked [`Good first issue`](https://github.com/apache/dubbo/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) or [`Help wanted`](https://github.com/apache/dubbo/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22).
|
||||
* Join the discussion on the mailing list, subscription [guide](https://github.com/apache/dubbo/wiki/Mailing-list-subscription-guide).
|
||||
* Answer questions on [issues](https://github.com/apache/dubbo/issues).
|
||||
* Fix bugs reported on [issues](https://github.com/apache/dubbo/issues), and send us a pull request.
|
||||
* Review the existing [pull request](https://github.com/apache/dubbo/pulls).
|
||||
* Improve the [website](https://github.com/apache/dubbo-website), typically we need
|
||||
* blog post
|
||||
* translation on documentation
|
||||
* use cases around the integration of Dubbo in enterprise systems.
|
||||
* Improve the [dubbo-admin/dubbo-monitor](https://github.com/apache/dubbo-admin).
|
||||
* Contribute to the projects listed in [ecosystem](https://github.com/dubbo).
|
||||
* Other forms of contribution not explicitly enumerated above.
|
||||
* If you would like to contribute, please send an email to dev@dubbo.apache.org to let us know!
|
||||
|
||||
## Reporting bugs
|
||||
|
||||
|
|
@ -241,20 +223,12 @@ Please follow the [template](https://github.com/apache/dubbo/issues/new?template
|
|||
|
||||
Please report security vulnerabilities to [us](mailto:security@dubbo.apache.org) privately.
|
||||
|
||||
## Contact
|
||||
|
||||
* Mailing list:
|
||||
* dev list: for dev/user discussion. [subscribe](mailto:dev-subscribe@dubbo.apache.org), [unsubscribe](mailto:dev-unsubscribe@dubbo.apache.org), [archive](https://lists.apache.org/list.html?dev@dubbo.apache.org), [guide](https://github.com/apache/dubbo/wiki/Mailing-list-subscription-guide)
|
||||
|
||||
* Bugs: [Issues](https://github.com/apache/dubbo/issues/new?template=dubbo-issue-report-template.md)
|
||||
* Gitter: [Gitter channel](https://gitter.im/alibaba/dubbo)
|
||||
* Twitter: [@ApacheDubbo](https://twitter.com/ApacheDubbo)
|
||||
|
||||
## Dubbo ecosystem
|
||||
|
||||
* [Dubbo Ecosystem Entry](https://github.com/apache?utf8=%E2%9C%93&q=dubbo&type=&language=) - A GitHub group `dubbo` to gather all Dubbo relevant projects not appropriate in [apache](https://github.com/apache) group yet
|
||||
* [Dubbo Website](https://github.com/apache/dubbo-website) - Apache Dubbo official website
|
||||
* [Dubbo Samples](https://github.com/apache/dubbo-samples) - samples for Apache Dubbo
|
||||
* [Dubbo Spring Boot](https://github.com/apache/dubbo-spring-boot-project) - Spring Boot Project for Dubbo
|
||||
* [Dubbo Admin](https://github.com/apache/dubbo-admin) - The reference implementation for Dubbo admin
|
||||
* [Dubbo Awesome](https://github.com/apache/dubbo-awesome) - Dubbo's slides and video links in Meetup
|
||||
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ public class SingleRouterChain<T> {
|
|||
public RouterSnapshotNode<T> buildRouterSnapshot(
|
||||
URL url, BitList<Invoker<T>> availableInvokers, Invocation invocation) {
|
||||
BitList<Invoker<T>> resultInvokers = availableInvokers.clone();
|
||||
RouterSnapshotNode<T> parentNode = new RouterSnapshotNode<>("Parent", resultInvokers.clone());
|
||||
RouterSnapshotNode<T> parentNode = new RouterSnapshotNode<T>("Parent", resultInvokers.clone());
|
||||
parentNode.setNodeOutputInvokers(resultInvokers.clone());
|
||||
|
||||
// 1. route state router
|
||||
|
|
@ -227,7 +227,7 @@ public class SingleRouterChain<T> {
|
|||
return parentNode;
|
||||
}
|
||||
|
||||
RouterSnapshotNode<T> commonRouterNode = new RouterSnapshotNode<>("CommonRouter", resultInvokers.clone());
|
||||
RouterSnapshotNode<T> commonRouterNode = new RouterSnapshotNode<T>("CommonRouter", resultInvokers.clone());
|
||||
parentNode.appendNode(commonRouterNode);
|
||||
List<Invoker<T>> commonRouterResult = resultInvokers;
|
||||
|
||||
|
|
@ -237,7 +237,7 @@ public class SingleRouterChain<T> {
|
|||
List<Invoker<T>> inputInvokers = new ArrayList<>(commonRouterResult);
|
||||
|
||||
RouterSnapshotNode<T> currentNode =
|
||||
new RouterSnapshotNode<>(router.getClass().getSimpleName(), inputInvokers);
|
||||
new RouterSnapshotNode<T>(router.getClass().getSimpleName(), inputInvokers);
|
||||
|
||||
// append to router node chain
|
||||
commonRouterNode.appendNode(currentNode);
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ public abstract class AbstractConfigurator implements Configurator {
|
|||
}
|
||||
|
||||
private Set<String> genConditionKeys() {
|
||||
Set<String> conditionKeys = new HashSet<>();
|
||||
Set<String> conditionKeys = new HashSet<String>();
|
||||
conditionKeys.add(CATEGORY_KEY);
|
||||
conditionKeys.add(Constants.CHECK_KEY);
|
||||
conditionKeys.add(DYNAMIC_KEY);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
|||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.threadpool.manager.FrameworkExecutorRepository;
|
||||
import org.apache.dubbo.common.utils.ConcurrentHashSet;
|
||||
import org.apache.dubbo.common.utils.LockUtils;
|
||||
import org.apache.dubbo.common.utils.NetUtils;
|
||||
import org.apache.dubbo.common.utils.StringUtils;
|
||||
import org.apache.dubbo.metrics.event.MetricsEventBus;
|
||||
|
|
@ -57,8 +56,6 @@ import java.util.concurrent.ScheduledFuture;
|
|||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER;
|
||||
|
|
@ -125,8 +122,6 @@ public abstract class AbstractDirectory<T> implements Directory<T> {
|
|||
|
||||
private volatile ScheduledFuture<?> connectivityCheckFuture;
|
||||
|
||||
private final ReentrantLock invokerRefreshLock = new ReentrantLock();
|
||||
|
||||
/**
|
||||
* The max count of invokers for each reconnect task select to try to reconnect.
|
||||
*/
|
||||
|
|
@ -298,19 +293,17 @@ public abstract class AbstractDirectory<T> implements Directory<T> {
|
|||
|
||||
@Override
|
||||
public void addInvalidateInvoker(Invoker<T> invoker) {
|
||||
LockUtils.safeLock(invokerRefreshLock, LockUtils.DEFAULT_TIMEOUT, () -> {
|
||||
// 1. remove this invoker from validInvokers list, this invoker will not be listed in the next time
|
||||
if (removeValidInvoker(invoker)) {
|
||||
// 2. add this invoker to reconnect list
|
||||
invokersToReconnect.add(invoker);
|
||||
// 3. try start check connectivity task
|
||||
checkConnectivity();
|
||||
// 1. remove this invoker from validInvokers list, this invoker will not be listed in the next time
|
||||
if (removeValidInvoker(invoker)) {
|
||||
// 2. add this invoker to reconnect list
|
||||
invokersToReconnect.add(invoker);
|
||||
// 3. try start check connectivity task
|
||||
checkConnectivity();
|
||||
|
||||
logger.info("The invoker " + invoker.getUrl()
|
||||
+ " has been added to invalidate list due to connectivity problem. "
|
||||
+ "Will trying to reconnect to it in the background.");
|
||||
}
|
||||
});
|
||||
logger.info("The invoker " + invoker.getUrl()
|
||||
+ " has been added to invalidate list due to connectivity problem. "
|
||||
+ "Will trying to reconnect to it in the background.");
|
||||
}
|
||||
}
|
||||
|
||||
public void checkConnectivity() {
|
||||
|
|
@ -329,30 +322,23 @@ public abstract class AbstractDirectory<T> implements Directory<T> {
|
|||
// 1. pick invokers from invokersToReconnect
|
||||
// limit max reconnectTaskTryCount, prevent this task hang up all the connectivityExecutor
|
||||
// for long time
|
||||
LockUtils.safeLock(invokerRefreshLock, LockUtils.DEFAULT_TIMEOUT, () -> {
|
||||
if (invokersToReconnect.size() < reconnectTaskTryCount) {
|
||||
invokersToTry.addAll(invokersToReconnect);
|
||||
} else {
|
||||
for (int i = 0; i < reconnectTaskTryCount; i++) {
|
||||
Invoker<T> tInvoker = invokersToReconnect.get(
|
||||
ThreadLocalRandom.current().nextInt(invokersToReconnect.size()));
|
||||
if (!invokersToTry.contains(tInvoker)) {
|
||||
// ignore if is selected, invokersToTry's size is always smaller than
|
||||
// reconnectTaskTryCount + 1
|
||||
invokersToTry.add(tInvoker);
|
||||
}
|
||||
if (invokersToReconnect.size() < reconnectTaskTryCount) {
|
||||
invokersToTry.addAll(invokersToReconnect);
|
||||
} else {
|
||||
for (int i = 0; i < reconnectTaskTryCount; i++) {
|
||||
Invoker<T> tInvoker = invokersToReconnect.get(
|
||||
ThreadLocalRandom.current().nextInt(invokersToReconnect.size()));
|
||||
if (!invokersToTry.contains(tInvoker)) {
|
||||
// ignore if is selected, invokersToTry's size is always smaller than
|
||||
// reconnectTaskTryCount + 1
|
||||
invokersToTry.add(tInvoker);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 2. try to check the invoker's status
|
||||
for (Invoker<T> invoker : invokersToTry) {
|
||||
AtomicBoolean invokerExist = new AtomicBoolean(false);
|
||||
LockUtils.safeLock(invokerRefreshLock, LockUtils.DEFAULT_TIMEOUT, () -> {
|
||||
invokerExist.set(invokers.contains(invoker));
|
||||
});
|
||||
// Should not lock here, `invoker.isAvailable` may need some time to check
|
||||
if (invokerExist.get()) {
|
||||
if (invokers.contains(invoker)) {
|
||||
if (invoker.isAvailable()) {
|
||||
needDeleteList.add(invoker);
|
||||
}
|
||||
|
|
@ -362,37 +348,22 @@ public abstract class AbstractDirectory<T> implements Directory<T> {
|
|||
}
|
||||
|
||||
// 3. recover valid invoker
|
||||
LockUtils.safeLock(invokerRefreshLock, LockUtils.DEFAULT_TIMEOUT, () -> {
|
||||
for (Invoker<T> tInvoker : needDeleteList) {
|
||||
if (invokers.contains(tInvoker)) {
|
||||
addValidInvoker(tInvoker);
|
||||
logger.info("Recover service address: " + tInvoker.getUrl()
|
||||
+ " from invalid list.");
|
||||
} else {
|
||||
logger.info(
|
||||
"The invoker " + tInvoker.getUrl()
|
||||
+ " has been removed from invokers list. Will remove it in reconnect list.");
|
||||
}
|
||||
invokersToReconnect.remove(tInvoker);
|
||||
for (Invoker<T> tInvoker : needDeleteList) {
|
||||
if (invokers.contains(tInvoker)) {
|
||||
addValidInvoker(tInvoker);
|
||||
logger.info(
|
||||
"Recover service address: " + tInvoker.getUrl() + " from invalid list.");
|
||||
}
|
||||
});
|
||||
} catch (Throwable t) {
|
||||
logger.error(
|
||||
LoggerCodeConstants.INTERNAL_ERROR,
|
||||
"",
|
||||
"",
|
||||
"Error occurred when check connectivity. ",
|
||||
t);
|
||||
invokersToReconnect.remove(tInvoker);
|
||||
}
|
||||
} finally {
|
||||
checkConnectivityPermit.release();
|
||||
}
|
||||
|
||||
// 4. submit new task if it has more to recover
|
||||
LockUtils.safeLock(invokerRefreshLock, LockUtils.DEFAULT_TIMEOUT, () -> {
|
||||
if (!invokersToReconnect.isEmpty()) {
|
||||
checkConnectivity();
|
||||
}
|
||||
});
|
||||
if (!invokersToReconnect.isEmpty()) {
|
||||
checkConnectivity();
|
||||
}
|
||||
MetricsEventBus.publish(RegistryEvent.refreshDirectoryEvent(
|
||||
applicationModel, getSummary(), getDirectoryMeta()));
|
||||
},
|
||||
|
|
@ -411,11 +382,9 @@ public abstract class AbstractDirectory<T> implements Directory<T> {
|
|||
* 4. all the invokers disappeared from total invokers should be removed in the disabled invokers list
|
||||
*/
|
||||
public void refreshInvoker() {
|
||||
LockUtils.safeLock(invokerRefreshLock, LockUtils.DEFAULT_TIMEOUT, () -> {
|
||||
if (invokersInitialized) {
|
||||
refreshInvokerInternal();
|
||||
}
|
||||
});
|
||||
if (invokersInitialized) {
|
||||
refreshInvokerInternal();
|
||||
}
|
||||
MetricsEventBus.publish(
|
||||
RegistryEvent.refreshDirectoryEvent(applicationModel, getSummary(), getDirectoryMeta()));
|
||||
}
|
||||
|
|
@ -424,7 +393,7 @@ public abstract class AbstractDirectory<T> implements Directory<T> {
|
|||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
private void refreshInvokerInternal() {
|
||||
private synchronized void refreshInvokerInternal() {
|
||||
BitList<Invoker<T>> copiedInvokers = invokers.clone();
|
||||
refreshInvokers(copiedInvokers, invokersToReconnect);
|
||||
refreshInvokers(copiedInvokers, disabledInvokers);
|
||||
|
|
@ -445,29 +414,25 @@ public abstract class AbstractDirectory<T> implements Directory<T> {
|
|||
|
||||
@Override
|
||||
public void addDisabledInvoker(Invoker<T> invoker) {
|
||||
LockUtils.safeLock(invokerRefreshLock, LockUtils.DEFAULT_TIMEOUT, () -> {
|
||||
if (invokers.contains(invoker)) {
|
||||
disabledInvokers.add(invoker);
|
||||
removeValidInvoker(invoker);
|
||||
logger.info("Disable service address: " + invoker.getUrl() + ".");
|
||||
}
|
||||
});
|
||||
if (invokers.contains(invoker)) {
|
||||
disabledInvokers.add(invoker);
|
||||
removeValidInvoker(invoker);
|
||||
logger.info("Disable service address: " + invoker.getUrl() + ".");
|
||||
}
|
||||
MetricsEventBus.publish(
|
||||
RegistryEvent.refreshDirectoryEvent(applicationModel, getSummary(), getDirectoryMeta()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recoverDisabledInvoker(Invoker<T> invoker) {
|
||||
LockUtils.safeLock(invokerRefreshLock, LockUtils.DEFAULT_TIMEOUT, () -> {
|
||||
if (disabledInvokers.remove(invoker)) {
|
||||
try {
|
||||
addValidInvoker(invoker);
|
||||
logger.info("Recover service address: " + invoker.getUrl() + " from disabled list.");
|
||||
} catch (Throwable ignore) {
|
||||
if (disabledInvokers.remove(invoker)) {
|
||||
try {
|
||||
addValidInvoker(invoker);
|
||||
logger.info("Recover service address: " + invoker.getUrl() + " from disabled list.");
|
||||
} catch (Throwable ignore) {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
MetricsEventBus.publish(
|
||||
RegistryEvent.refreshDirectoryEvent(applicationModel, getSummary(), getDirectoryMeta()));
|
||||
}
|
||||
|
|
@ -526,11 +491,9 @@ public abstract class AbstractDirectory<T> implements Directory<T> {
|
|||
}
|
||||
|
||||
protected void setInvokers(BitList<Invoker<T>> invokers) {
|
||||
LockUtils.safeLock(invokerRefreshLock, LockUtils.DEFAULT_TIMEOUT, () -> {
|
||||
this.invokers = invokers;
|
||||
refreshInvokerInternal();
|
||||
this.invokersInitialized = true;
|
||||
});
|
||||
this.invokers = invokers;
|
||||
refreshInvokerInternal();
|
||||
this.invokersInitialized = true;
|
||||
|
||||
MetricsEventBus.publish(
|
||||
RegistryEvent.refreshDirectoryEvent(applicationModel, getSummary(), getDirectoryMeta()));
|
||||
|
|
@ -538,31 +501,29 @@ public abstract class AbstractDirectory<T> implements Directory<T> {
|
|||
|
||||
protected void destroyInvokers() {
|
||||
// set empty instead of clearing to support concurrent access.
|
||||
LockUtils.safeLock(invokerRefreshLock, LockUtils.DEFAULT_TIMEOUT, () -> {
|
||||
this.invokers = BitList.emptyList();
|
||||
this.validInvokers = BitList.emptyList();
|
||||
this.invokersInitialized = false;
|
||||
});
|
||||
this.invokers = BitList.emptyList();
|
||||
this.validInvokers = BitList.emptyList();
|
||||
this.invokersInitialized = false;
|
||||
}
|
||||
|
||||
private boolean addValidInvoker(Invoker<T> invoker) {
|
||||
AtomicBoolean result = new AtomicBoolean(false);
|
||||
LockUtils.safeLock(invokerRefreshLock, LockUtils.DEFAULT_TIMEOUT, () -> {
|
||||
result.set(this.validInvokers.add(invoker));
|
||||
});
|
||||
boolean result;
|
||||
synchronized (this.validInvokers) {
|
||||
result = this.validInvokers.add(invoker);
|
||||
}
|
||||
MetricsEventBus.publish(
|
||||
RegistryEvent.refreshDirectoryEvent(applicationModel, getSummary(), getDirectoryMeta()));
|
||||
return result.get();
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean removeValidInvoker(Invoker<T> invoker) {
|
||||
AtomicBoolean result = new AtomicBoolean(false);
|
||||
LockUtils.safeLock(invokerRefreshLock, LockUtils.DEFAULT_TIMEOUT, () -> {
|
||||
result.set(this.validInvokers.remove(invoker));
|
||||
});
|
||||
boolean result;
|
||||
synchronized (this.validInvokers) {
|
||||
result = this.validInvokers.remove(invoker);
|
||||
}
|
||||
MetricsEventBus.publish(
|
||||
RegistryEvent.refreshDirectoryEvent(applicationModel, getSummary(), getDirectoryMeta()));
|
||||
return result.get();
|
||||
return result;
|
||||
}
|
||||
|
||||
protected abstract List<Invoker<T>> doList(
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package org.apache.dubbo.rpc.cluster.filter.support;
|
|||
import org.apache.dubbo.common.extension.Activate;
|
||||
import org.apache.dubbo.common.extension.ExtensionLoader;
|
||||
import org.apache.dubbo.common.utils.CollectionUtils;
|
||||
import org.apache.dubbo.common.utils.NetUtils;
|
||||
import org.apache.dubbo.rpc.AsyncRpcResult;
|
||||
import org.apache.dubbo.rpc.Filter;
|
||||
import org.apache.dubbo.rpc.Invocation;
|
||||
|
|
@ -62,7 +63,10 @@ public class ConsumerContextFilter implements ClusterFilter, ClusterFilter.Liste
|
|||
|
||||
@Override
|
||||
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
|
||||
RpcContext.getServiceContext().setInvoker(invoker).setInvocation(invocation);
|
||||
RpcContext.getServiceContext()
|
||||
.setInvoker(invoker)
|
||||
.setInvocation(invocation)
|
||||
.setLocalAddress(NetUtils.getLocalHost(), 0);
|
||||
|
||||
RpcContext context = RpcContext.getClientAttachment();
|
||||
context.setAttachment(REMOTE_APPLICATION_KEY, invoker.getUrl().getApplication());
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ public class ConsistentHashLoadBalance extends AbstractLoadBalance {
|
|||
*/
|
||||
public static final String HASH_ARGUMENTS = "hash.arguments";
|
||||
|
||||
private final ConcurrentMap<String, ConsistentHashSelector<?>> selectors = new ConcurrentHashMap<>();
|
||||
private final ConcurrentMap<String, ConsistentHashSelector<?>> selectors =
|
||||
new ConcurrentHashMap<String, ConsistentHashSelector<?>>();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
|
|
@ -74,7 +75,7 @@ public class ConsistentHashLoadBalance extends AbstractLoadBalance {
|
|||
private final int[] argumentIndex;
|
||||
|
||||
ConsistentHashSelector(List<Invoker<T>> invokers, String methodName, int identityHashCode) {
|
||||
this.virtualInvokers = new TreeMap<>();
|
||||
this.virtualInvokers = new TreeMap<Long, Invoker<T>>();
|
||||
this.identityHashCode = identityHashCode;
|
||||
URL url = invokers.get(0).getUrl();
|
||||
this.replicaNumber = url.getMethodParameter(methodName, HASH_NODES, 160);
|
||||
|
|
@ -96,12 +97,14 @@ public class ConsistentHashLoadBalance extends AbstractLoadBalance {
|
|||
}
|
||||
|
||||
public Invoker<T> select(Invocation invocation) {
|
||||
String key = toKey(RpcUtils.getArguments(invocation));
|
||||
|
||||
byte[] digest = Bytes.getMD5(key);
|
||||
byte[] digest = Bytes.getMD5(RpcUtils.getMethodName(invocation));
|
||||
return selectForKey(hash(digest, 0));
|
||||
}
|
||||
|
||||
private String toKey(Object[] args, boolean isGeneric) {
|
||||
return isGeneric ? toKey((Object[]) args[1]) : toKey(args);
|
||||
}
|
||||
|
||||
private String toKey(Object[] args) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (int i : argumentIndex) {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class MapMerger implements Merger<Map<?, ?>> {
|
|||
if (ArrayUtils.isEmpty(items)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
Map<Object, Object> result = new HashMap<>();
|
||||
Map<Object, Object> result = new HashMap<Object, Object>();
|
||||
Stream.of(items).filter(Objects::nonNull).forEach(result::putAll);
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class MergerFactory implements ScopeModelAware {
|
|||
|
||||
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(MergerFactory.class);
|
||||
|
||||
private ConcurrentMap<Class<?>, Merger<?>> MERGER_CACHE = new ConcurrentHashMap<>();
|
||||
private ConcurrentMap<Class<?>, Merger<?>> MERGER_CACHE = new ConcurrentHashMap<Class<?>, Merger<?>>();
|
||||
private ScopeModel scopeModel;
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class SetMerger implements Merger<Set<?>> {
|
|||
if (ArrayUtils.isEmpty(items)) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
Set<Object> result = new HashSet<>();
|
||||
Set<Object> result = new HashSet<Object>();
|
||||
Stream.of(items).filter(Objects::nonNull).forEach(result::addAll);
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ public class ConditionStateRouter<T> extends AbstractStateRouter<T> {
|
|||
CLUSTER_CONDITIONAL_ROUTE_LIST_EMPTY,
|
||||
"condition state router thenCondition is empty",
|
||||
"",
|
||||
"The current consumer in the service blocklist. consumer: " + NetUtils.getLocalHost()
|
||||
"The current consumer in the service blacklist. consumer: " + NetUtils.getLocalHost()
|
||||
+ ", service: " + url.getServiceKey());
|
||||
if (needToPrintMessage) {
|
||||
messageHolder.set("Empty return. Reason: ThenCondition is empty.");
|
||||
|
|
|
|||
|
|
@ -30,6 +30,6 @@ public class ConditionStateRouterFactory extends CacheableStateRouterFactory {
|
|||
|
||||
@Override
|
||||
protected <T> StateRouter<T> createRouter(Class<T> interfaceClass, URL url) {
|
||||
return new ConditionStateRouter<>(url);
|
||||
return new ConditionStateRouter<T>(url);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,6 @@ public class ServiceStateRouterFactory extends CacheableStateRouterFactory {
|
|||
|
||||
@Override
|
||||
protected <T> StateRouter<T> createRouter(Class<T> interfaceClass, URL url) {
|
||||
return new ServiceStateRouter<>(url);
|
||||
return new ServiceStateRouter<T>(url);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ public class MeshRuleCache<T> {
|
|||
Collections.unmodifiableMap(totalSubsetMap),
|
||||
unmatchedInvokers);
|
||||
} else {
|
||||
return new MeshRuleCache<>(
|
||||
return new MeshRuleCache<T>(
|
||||
Collections.emptyList(), Collections.emptyMap(), Collections.emptyMap(), invokers);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,6 @@ public class MockStateRouterFactory implements StateRouterFactory {
|
|||
|
||||
@Override
|
||||
public <T> StateRouter<T> getRouter(Class<T> interfaceClass, URL url) {
|
||||
return new MockInvokersSelector<>(url);
|
||||
return new MockInvokersSelector<T>(url);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,23 +93,23 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
}
|
||||
|
||||
// Provided by BitList only
|
||||
public synchronized List<E> getOriginList() {
|
||||
public List<E> getOriginList() {
|
||||
return originList;
|
||||
}
|
||||
|
||||
public synchronized void addIndex(int index) {
|
||||
public void addIndex(int index) {
|
||||
this.rootSet.set(index);
|
||||
}
|
||||
|
||||
public synchronized int totalSetSize() {
|
||||
public int totalSetSize() {
|
||||
return this.originList.size();
|
||||
}
|
||||
|
||||
public synchronized boolean indexExist(int index) {
|
||||
public boolean indexExist(int index) {
|
||||
return this.rootSet.get(index);
|
||||
}
|
||||
|
||||
public synchronized E getByIndex(int index) {
|
||||
public E getByIndex(int index) {
|
||||
return this.originList.get(index);
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
* @param target target bitList
|
||||
* @return this bitList only contains those elements contain in both two list and source bitList's tailList
|
||||
*/
|
||||
public synchronized BitList<E> and(BitList<E> target) {
|
||||
public BitList<E> and(BitList<E> target) {
|
||||
rootSet.and(target.rootSet);
|
||||
if (target.getTailList() != null) {
|
||||
target.getTailList().forEach(this::addToTailList);
|
||||
|
|
@ -128,28 +128,28 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
return this;
|
||||
}
|
||||
|
||||
public synchronized BitList<E> or(BitList<E> target) {
|
||||
public BitList<E> or(BitList<E> target) {
|
||||
BitSet resultSet = (BitSet) rootSet.clone();
|
||||
resultSet.or(target.rootSet);
|
||||
return new BitList<>(originList, resultSet, tailList);
|
||||
}
|
||||
|
||||
public synchronized boolean hasMoreElementInTailList() {
|
||||
public boolean hasMoreElementInTailList() {
|
||||
return CollectionUtils.isNotEmpty(tailList);
|
||||
}
|
||||
|
||||
public synchronized List<E> getTailList() {
|
||||
public List<E> getTailList() {
|
||||
return tailList;
|
||||
}
|
||||
|
||||
public synchronized void addToTailList(E e) {
|
||||
public void addToTailList(E e) {
|
||||
if (tailList == null) {
|
||||
tailList = new LinkedList<>();
|
||||
}
|
||||
tailList.add(e);
|
||||
}
|
||||
|
||||
public synchronized E randomSelectOne() {
|
||||
public E randomSelectOne() {
|
||||
int originSize = originList.size();
|
||||
int tailSize = tailList != null ? tailList.size() : 0;
|
||||
int totalSize = originSize + tailSize;
|
||||
|
|
@ -181,18 +181,18 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
|
||||
// Provided by JDK List interface
|
||||
@Override
|
||||
public synchronized int size() {
|
||||
public int size() {
|
||||
return rootSet.cardinality() + (CollectionUtils.isNotEmpty(tailList) ? tailList.size() : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean contains(Object o) {
|
||||
public boolean contains(Object o) {
|
||||
int idx = originList.indexOf(o);
|
||||
return (idx >= 0 && rootSet.get(idx)) || (CollectionUtils.isNotEmpty(tailList) && tailList.contains(o));
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Iterator<E> iterator() {
|
||||
public Iterator<E> iterator() {
|
||||
return new BitListIterator<>(this, 0);
|
||||
}
|
||||
|
||||
|
|
@ -205,7 +205,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
* Notice: It is not recommended adding duplicated element.
|
||||
*/
|
||||
@Override
|
||||
public synchronized boolean add(E e) {
|
||||
public boolean add(E e) {
|
||||
int index = originList.indexOf(e);
|
||||
if (index > -1) {
|
||||
rootSet.set(index);
|
||||
|
|
@ -225,7 +225,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
* If the element is not contained in originList, try to remove from tailList.
|
||||
*/
|
||||
@Override
|
||||
public synchronized boolean remove(Object o) {
|
||||
public boolean remove(Object o) {
|
||||
int idx = originList.indexOf(o);
|
||||
if (idx > -1 && rootSet.get(idx)) {
|
||||
rootSet.set(idx, false);
|
||||
|
|
@ -242,7 +242,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
* This may change the default behaviour when adding new element later.
|
||||
*/
|
||||
@Override
|
||||
public synchronized void clear() {
|
||||
public void clear() {
|
||||
rootSet.clear();
|
||||
// to remove references
|
||||
originList = Collections.emptyList();
|
||||
|
|
@ -252,7 +252,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized E get(int index) {
|
||||
public E get(int index) {
|
||||
int bitIndex = -1;
|
||||
if (index < 0) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
|
|
@ -272,7 +272,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized E remove(int index) {
|
||||
public E remove(int index) {
|
||||
int bitIndex = -1;
|
||||
if (index >= rootSet.cardinality()) {
|
||||
if (CollectionUtils.isNotEmpty(tailList)) {
|
||||
|
|
@ -290,7 +290,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized int indexOf(Object o) {
|
||||
public int indexOf(Object o) {
|
||||
int bitIndex = -1;
|
||||
for (int i = 0; i < rootSet.cardinality(); i++) {
|
||||
bitIndex = rootSet.nextSetBit(bitIndex + 1);
|
||||
|
|
@ -311,7 +311,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public synchronized boolean addAll(Collection<? extends E> c) {
|
||||
public boolean addAll(Collection<? extends E> c) {
|
||||
if (c instanceof BitList) {
|
||||
rootSet.or(((BitList<? extends E>) c).rootSet);
|
||||
if (((BitList<? extends E>) c).hasMoreElementInTailList()) {
|
||||
|
|
@ -325,7 +325,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized int lastIndexOf(Object o) {
|
||||
public int lastIndexOf(Object o) {
|
||||
int bitIndex = -1;
|
||||
int index = -1;
|
||||
if (CollectionUtils.isNotEmpty(tailList)) {
|
||||
|
|
@ -344,22 +344,22 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isEmpty() {
|
||||
public boolean isEmpty() {
|
||||
return this.rootSet.isEmpty() && CollectionUtils.isEmpty(tailList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized ListIterator<E> listIterator() {
|
||||
public ListIterator<E> listIterator() {
|
||||
return new BitListIterator<>(this, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized ListIterator<E> listIterator(int index) {
|
||||
public ListIterator<E> listIterator(int index) {
|
||||
return new BitListIterator<>(this, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized BitList<E> subList(int fromIndex, int toIndex) {
|
||||
public BitList<E> subList(int fromIndex, int toIndex) {
|
||||
BitSet resultSet = (BitSet) rootSet.clone();
|
||||
List<E> copiedTailList = tailList == null ? null : new LinkedList<>(tailList);
|
||||
if (toIndex < size()) {
|
||||
|
|
@ -414,7 +414,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean hasNext() {
|
||||
public boolean hasNext() {
|
||||
if (isInTailList) {
|
||||
return tailListIterator.hasNext();
|
||||
} else {
|
||||
|
|
@ -428,7 +428,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized E next() {
|
||||
public E next() {
|
||||
if (isInTailList) {
|
||||
if (tailListIterator.hasNext()) {
|
||||
index += 1;
|
||||
|
|
@ -457,7 +457,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean hasPrevious() {
|
||||
public boolean hasPrevious() {
|
||||
if (isInTailList) {
|
||||
boolean hasPreviousInTailList = tailListIterator.hasPrevious();
|
||||
if (hasPreviousInTailList) {
|
||||
|
|
@ -471,7 +471,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized E previous() {
|
||||
public E previous() {
|
||||
if (isInTailList) {
|
||||
boolean hasPreviousInTailList = tailListIterator.hasPrevious();
|
||||
if (hasPreviousInTailList) {
|
||||
|
|
@ -503,17 +503,17 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized int nextIndex() {
|
||||
public int nextIndex() {
|
||||
return hasNext() ? index + 1 : index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized int previousIndex() {
|
||||
public int previousIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void remove() {
|
||||
public void remove() {
|
||||
if (lastReturnedIndex == -1) {
|
||||
throw new IllegalStateException();
|
||||
} else {
|
||||
|
|
@ -533,17 +533,17 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized void set(E e) {
|
||||
public void set(E e) {
|
||||
throw new UnsupportedOperationException("Set method is not supported in BitListIterator!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void add(E e) {
|
||||
public void add(E e) {
|
||||
throw new UnsupportedOperationException("Add method is not supported in BitListIterator!");
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized ArrayList<E> cloneToArrayList() {
|
||||
public ArrayList<E> cloneToArrayList() {
|
||||
if (rootSet.cardinality() == originList.size() && (CollectionUtils.isEmpty(tailList))) {
|
||||
return new ArrayList<>(originList);
|
||||
}
|
||||
|
|
@ -553,7 +553,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized BitList<E> clone() {
|
||||
public BitList<E> clone() {
|
||||
return new BitList<>(
|
||||
originList, (BitSet) rootSet.clone(), tailList == null ? null : new LinkedList<>(tailList));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,6 @@ public class TagStateRouterFactory extends CacheableStateRouterFactory {
|
|||
|
||||
@Override
|
||||
protected <T> StateRouter<T> createRouter(Class<T> interfaceClass, URL url) {
|
||||
return new TagStateRouter<>(url);
|
||||
return new TagStateRouter<T>(url);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ public class FailoverClusterInvoker<T> extends AbstractClusterInvoker<T> {
|
|||
int len = calculateInvokeTimes(methodName);
|
||||
// retry loop.
|
||||
RpcException le = null; // last exception.
|
||||
List<Invoker<T>> invoked = new ArrayList<>(copyInvokers.size()); // invoked invokers.
|
||||
Set<String> providers = new HashSet<>(len);
|
||||
List<Invoker<T>> invoked = new ArrayList<Invoker<T>>(copyInvokers.size()); // invoked invokers.
|
||||
Set<String> providers = new HashSet<String>(len);
|
||||
for (int i = 0; i < len; i++) {
|
||||
// Reselect before retry to avoid a change of candidate `invokers`.
|
||||
// NOTE: if `invokers` changed, then `invoked` also lose accuracy.
|
||||
|
|
|
|||
|
|
@ -26,6 +26,6 @@ public class MergeableCluster extends AbstractCluster {
|
|||
|
||||
@Override
|
||||
public <T> AbstractClusterInvoker<T> doJoin(Directory<T> directory) throws RpcException {
|
||||
return new MergeableClusterInvoker<>(directory);
|
||||
return new MergeableClusterInvoker<T>(directory);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,6 @@ public class ZoneAwareCluster extends AbstractCluster {
|
|||
|
||||
@Override
|
||||
protected <T> AbstractClusterInvoker<T> doJoin(Directory<T> directory) throws RpcException {
|
||||
return new ZoneAwareClusterInvoker<>(directory);
|
||||
return new ZoneAwareClusterInvoker<T>(directory);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class MockClusterWrapper implements Cluster {
|
|||
|
||||
@Override
|
||||
public <T> Invoker<T> join(Directory<T> directory, boolean buildFilterChain) throws RpcException {
|
||||
return new MockClusterInvoker<>(directory, this.cluster.join(directory, buildFilterChain));
|
||||
return new MockClusterInvoker<T>(directory, this.cluster.join(directory, buildFilterChain));
|
||||
}
|
||||
|
||||
public Cluster getCluster() {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
package org.apache.dubbo.rpc.cluster.loadbalance;
|
||||
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.rpc.Invocation;
|
||||
import org.apache.dubbo.rpc.Invoker;
|
||||
import org.apache.dubbo.rpc.cluster.LoadBalance;
|
||||
import org.apache.dubbo.rpc.cluster.RouterChain;
|
||||
|
|
@ -26,15 +25,11 @@ import org.apache.dubbo.rpc.cluster.router.state.BitList;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
class ConsistentHashLoadBalanceTest extends LoadBalanceBaseTest {
|
||||
|
||||
|
|
@ -50,34 +45,6 @@ class ConsistentHashLoadBalanceTest extends LoadBalanceBaseTest {
|
|||
Assertions.assertEquals(hitted, genericHitted, "hitted should equals to genericHitted");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testArgumentMatchAll() {
|
||||
Map<Invoker, AtomicLong> counter = new ConcurrentHashMap<Invoker, AtomicLong>();
|
||||
LoadBalance lb = getLoadBalance(ConsistentHashLoadBalance.NAME);
|
||||
for (Invoker invoker : invokers) {
|
||||
counter.put(invoker, new AtomicLong(0));
|
||||
}
|
||||
URL url = invokers.get(0).getUrl();
|
||||
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
Invocation invocation = mock(Invocation.class);
|
||||
String methodName = "method1";
|
||||
given(invocation.getMethodName()).willReturn("$invoke");
|
||||
String[] paraTypes = new String[] {String.class.getName(), String.class.getName(), String.class.getName()};
|
||||
Object[] argsObject = new Object[] {"arg" + i, "arg2", "arg3"};
|
||||
Object[] args = new Object[] {methodName, paraTypes, argsObject};
|
||||
given(invocation.getArguments()).willReturn(args);
|
||||
|
||||
for (int j = 0; j < 5; j++) {
|
||||
Invoker sinvoker = lb.select(invokers, url, invocation);
|
||||
counter.get(sinvoker).incrementAndGet();
|
||||
}
|
||||
}
|
||||
for (Invoker invoker : invokers) {
|
||||
Assertions.assertTrue(counter.get(invoker).get() > 0);
|
||||
}
|
||||
}
|
||||
|
||||
private Invoker findHitted(Map<Invoker, AtomicLong> invokerCounter) {
|
||||
Invoker invoker = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ import java.util.HashSet;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
|
@ -578,44 +576,4 @@ class BitListTest {
|
|||
set.add(new LinkedList<>(Arrays.asList("A", "B", "C", "D", "E", "F", "G")));
|
||||
Assertions.assertEquals(2, set.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testConcurrent() throws InterruptedException {
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
BitList<String> bitList = new BitList<>(Collections.singletonList("test"));
|
||||
bitList.remove("test");
|
||||
|
||||
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||
CountDownLatch countDownLatch2 = new CountDownLatch(2);
|
||||
|
||||
Thread thread1 = new Thread(() -> {
|
||||
try {
|
||||
countDownLatch.await();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
bitList.add("test");
|
||||
countDownLatch2.countDown();
|
||||
});
|
||||
|
||||
AtomicReference<BitList<String>> ref = new AtomicReference<>();
|
||||
Thread thread2 = new Thread(() -> {
|
||||
try {
|
||||
countDownLatch.await();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
ref.set(bitList.clone());
|
||||
countDownLatch2.countDown();
|
||||
});
|
||||
|
||||
thread1.start();
|
||||
thread2.start();
|
||||
|
||||
countDownLatch.countDown();
|
||||
countDownLatch2.await();
|
||||
|
||||
Assertions.assertDoesNotThrow(() -> ref.get().iterator().hasNext());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ public /*final**/ class URL implements Serializable {
|
|||
}
|
||||
|
||||
static String appendDefaultPort(String address, int defaultPort) {
|
||||
if (StringUtils.isNotEmpty(address) && defaultPort > 0) {
|
||||
if (address != null && address.length() > 0 && defaultPort > 0) {
|
||||
int i = address.indexOf(':');
|
||||
if (i < 0) {
|
||||
return address + ":" + defaultPort;
|
||||
|
|
@ -525,7 +525,7 @@ public /*final**/ class URL implements Serializable {
|
|||
List<URL> urls = new ArrayList<>();
|
||||
urls.add(this);
|
||||
String[] backups = getParameter(RemotingConstants.BACKUP_KEY, new String[0]);
|
||||
if (ArrayUtils.isNotEmpty(backups)) {
|
||||
if (backups != null && backups.length > 0) {
|
||||
for (String backup : backups) {
|
||||
urls.add(this.setAddress(backup));
|
||||
}
|
||||
|
|
@ -805,7 +805,7 @@ public /*final**/ class URL implements Serializable {
|
|||
|
||||
public boolean hasParameter(String key) {
|
||||
String value = getParameter(key);
|
||||
return StringUtils.isNotEmpty(value);
|
||||
return value != null && value.length() > 0;
|
||||
}
|
||||
|
||||
public String getMethodParameterAndDecoded(String method, String key) {
|
||||
|
|
@ -1061,7 +1061,7 @@ public /*final**/ class URL implements Serializable {
|
|||
}
|
||||
|
||||
public URL addParameters(String... pairs) {
|
||||
if (ArrayUtils.isEmpty(pairs)) {
|
||||
if (pairs == null || pairs.length == 0) {
|
||||
return this;
|
||||
}
|
||||
if (pairs.length % 2 != 0) {
|
||||
|
|
@ -1295,19 +1295,6 @@ public /*final**/ class URL implements Serializable {
|
|||
return serviceNameBuilder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* The format is "{interface}:[version]"
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getCompatibleColonSeparatedKey() {
|
||||
StringBuilder serviceNameBuilder = new StringBuilder();
|
||||
serviceNameBuilder.append(this.getServiceInterface());
|
||||
compatibleAppend(serviceNameBuilder, VERSION_KEY);
|
||||
compatibleAppend(serviceNameBuilder, GROUP_KEY);
|
||||
return serviceNameBuilder.toString();
|
||||
}
|
||||
|
||||
private void append(StringBuilder target, String parameterName, boolean first) {
|
||||
String parameterValue = this.getParameter(parameterName);
|
||||
if (!isBlank(parameterValue)) {
|
||||
|
|
@ -1320,14 +1307,6 @@ public /*final**/ class URL implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
private void compatibleAppend(StringBuilder target, String parameterName) {
|
||||
String parameterValue = this.getParameter(parameterName);
|
||||
if (!isBlank(parameterValue)) {
|
||||
target.append(':');
|
||||
target.append(parameterValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The format of return value is '{group}/{interfaceName}:{version}'
|
||||
*
|
||||
|
|
@ -1397,10 +1376,6 @@ public /*final**/ class URL implements Serializable {
|
|||
return buildString(true, false, true, true);
|
||||
}
|
||||
|
||||
public String toServiceString(String... parameters) {
|
||||
return buildString(true, true, true, true, parameters);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String getServiceName() {
|
||||
return getServiceInterface();
|
||||
|
|
@ -1614,9 +1589,9 @@ public /*final**/ class URL implements Serializable {
|
|||
return attributes == null ? Collections.emptyMap() : attributes;
|
||||
}
|
||||
|
||||
public URL addAttributes(Map<String, Object> attributeMap) {
|
||||
if (attributeMap != null) {
|
||||
attributes.putAll(attributeMap);
|
||||
public URL addAttributes(Map<String, Object> attributes) {
|
||||
if (attributes != null) {
|
||||
attributes.putAll(attributes);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
|
@ -1743,7 +1718,7 @@ public /*final**/ class URL implements Serializable {
|
|||
|
||||
public boolean hasServiceParameter(String service, String key) {
|
||||
String value = getServiceParameter(service, key);
|
||||
return StringUtils.isNotEmpty(value);
|
||||
return value != null && value.length() > 0;
|
||||
}
|
||||
|
||||
public float getPositiveServiceParameter(String service, String key, float defaultValue) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
package org.apache.dubbo.common;
|
||||
|
||||
import org.apache.dubbo.common.url.component.ServiceConfigURL;
|
||||
import org.apache.dubbo.common.utils.ArrayUtils;
|
||||
import org.apache.dubbo.common.utils.CollectionUtils;
|
||||
import org.apache.dubbo.common.utils.StringUtils;
|
||||
import org.apache.dubbo.rpc.model.ScopeModel;
|
||||
|
|
@ -377,7 +376,7 @@ public final class URLBuilder extends ServiceConfigURL {
|
|||
|
||||
@Override
|
||||
public URLBuilder addParameters(String... pairs) {
|
||||
if (ArrayUtils.isEmpty(pairs)) {
|
||||
if (pairs == null || pairs.length == 0) {
|
||||
return this;
|
||||
}
|
||||
if (pairs.length % 2 != 0) {
|
||||
|
|
@ -417,7 +416,7 @@ public final class URLBuilder extends ServiceConfigURL {
|
|||
|
||||
@Override
|
||||
public URLBuilder removeParameters(String... keys) {
|
||||
if (ArrayUtils.isEmpty(keys)) {
|
||||
if (keys == null || keys.length == 0) {
|
||||
return this;
|
||||
}
|
||||
for (String key : keys) {
|
||||
|
|
@ -459,7 +458,7 @@ public final class URLBuilder extends ServiceConfigURL {
|
|||
return false;
|
||||
}
|
||||
String value = getMethodParameter(method, key);
|
||||
return StringUtils.isNotEmpty(value);
|
||||
return value != null && value.length() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
package org.apache.dubbo.common;
|
||||
|
||||
import org.apache.dubbo.common.constants.CommonConstants;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.utils.StringUtils;
|
||||
|
|
@ -61,7 +60,7 @@ public final class Version {
|
|||
public static final int LOWEST_VERSION_FOR_RESPONSE_ATTACHMENT = 2000200; // 2.0.2
|
||||
|
||||
public static final int HIGHEST_PROTOCOL_VERSION = 2009900; // 2.0.99
|
||||
private static final Map<String, Integer> VERSION2INT = new HashMap<>();
|
||||
private static final Map<String, Integer> VERSION2INT = new HashMap<String, Integer>();
|
||||
|
||||
static {
|
||||
// get dubbo version and last commit id
|
||||
|
|
@ -85,8 +84,7 @@ public final class Version {
|
|||
}
|
||||
|
||||
private static void tryLoadVersionFromResource() throws IOException {
|
||||
Enumeration<URL> configLoader =
|
||||
Version.class.getClassLoader().getResources(CommonConstants.DUBBO_VERSIONS_KEY + "/dubbo-common");
|
||||
Enumeration<URL> configLoader = Version.class.getClassLoader().getResources("META-INF/versions/dubbo-common");
|
||||
if (configLoader.hasMoreElements()) {
|
||||
URL url = configLoader.nextElement();
|
||||
try (BufferedReader reader =
|
||||
|
|
@ -314,7 +312,7 @@ public final class Version {
|
|||
|
||||
private static void checkArtifact(String artifactId) throws IOException {
|
||||
Enumeration<URL> artifactEnumeration =
|
||||
Version.class.getClassLoader().getResources(CommonConstants.DUBBO_VERSIONS_KEY + artifactId);
|
||||
Version.class.getClassLoader().getResources("META-INF/versions/" + artifactId);
|
||||
while (artifactEnumeration.hasMoreElements()) {
|
||||
URL url = artifactEnumeration.nextElement();
|
||||
try (BufferedReader reader =
|
||||
|
|
@ -350,7 +348,7 @@ public final class Version {
|
|||
|
||||
private static Set<String> loadArtifactIds() throws IOException {
|
||||
Enumeration<URL> artifactsEnumeration =
|
||||
Version.class.getClassLoader().getResources(CommonConstants.DUBBO_VERSIONS_KEY + "/.artifacts");
|
||||
Version.class.getClassLoader().getResources("META-INF/versions/.artifacts");
|
||||
Set<String> artifactIds = new HashSet<>();
|
||||
while (artifactsEnumeration.hasMoreElements()) {
|
||||
URL url = artifactsEnumeration.nextElement();
|
||||
|
|
|
|||
|
|
@ -25,13 +25,11 @@ import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
|||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.resource.Disposable;
|
||||
import org.apache.dubbo.common.utils.ConcurrentHashMapUtils;
|
||||
import org.apache.dubbo.common.utils.ConcurrentHashSet;
|
||||
import org.apache.dubbo.common.utils.StringUtils;
|
||||
import org.apache.dubbo.rpc.model.ScopeModelAccessor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
|
@ -55,7 +53,7 @@ public class ScopeBeanFactory {
|
|||
private final List<BeanInfo> registeredBeanInfos = new CopyOnWriteArrayList<>();
|
||||
private InstantiationStrategy instantiationStrategy;
|
||||
private final AtomicBoolean destroyed = new AtomicBoolean();
|
||||
private final Set<Class<?>> registeredClasses = new ConcurrentHashSet<>();
|
||||
private List<Class<?>> registeredClasses = new ArrayList<>();
|
||||
|
||||
public ScopeBeanFactory(ScopeBeanFactory parent, ExtensionAccessor extensionAccessor) {
|
||||
this.parent = parent;
|
||||
|
|
@ -301,7 +299,7 @@ public class ScopeBeanFactory {
|
|||
}
|
||||
}
|
||||
|
||||
public Set<Class<?>> getRegisteredClasses() {
|
||||
public List<Class<?>> getRegisteredClasses() {
|
||||
return registeredClasses;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import java.util.Map;
|
|||
public final class JavaBeanSerializeUtil {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(JavaBeanSerializeUtil.class);
|
||||
private static final Map<String, Class<?>> TYPES = new HashMap<>();
|
||||
private static final Map<String, Class<?>> TYPES = new HashMap<String, Class<?>>();
|
||||
private static final String ARRAY_PREFIX = "[";
|
||||
private static final String REFERENCE_TYPE_PREFIX = "L";
|
||||
private static final String REFERENCE_TYPE_SUFFIX = ";";
|
||||
|
|
@ -72,7 +72,7 @@ public final class JavaBeanSerializeUtil {
|
|||
if (obj instanceof JavaBeanDescriptor) {
|
||||
return (JavaBeanDescriptor) obj;
|
||||
}
|
||||
IdentityHashMap<Object, JavaBeanDescriptor> cache = new IdentityHashMap<>();
|
||||
IdentityHashMap<Object, JavaBeanDescriptor> cache = new IdentityHashMap<Object, JavaBeanDescriptor>();
|
||||
return createDescriptorIfAbsent(obj, accessor, cache);
|
||||
}
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ public final class JavaBeanSerializeUtil {
|
|||
if (beanDescriptor == null) {
|
||||
return null;
|
||||
}
|
||||
IdentityHashMap<JavaBeanDescriptor, Object> cache = new IdentityHashMap<>();
|
||||
IdentityHashMap<JavaBeanDescriptor, Object> cache = new IdentityHashMap<JavaBeanDescriptor, Object>();
|
||||
Object result = instantiateForDeserialize(beanDescriptor, loader, cache);
|
||||
deserializeInternal(result, beanDescriptor, loader, cache);
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ public abstract class Mixin {
|
|||
|
||||
Class<?> neighbor = null;
|
||||
// impl methods.
|
||||
Set<String> worked = new HashSet<>();
|
||||
Set<String> worked = new HashSet<String>();
|
||||
for (int i = 0; i < ics.length; i++) {
|
||||
if (!Modifier.isPublic(ics[i].getModifiers())) {
|
||||
String npkg = ics[i].getPackage().getName();
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ import javassist.CtMethod;
|
|||
* Wrapper.
|
||||
*/
|
||||
public abstract class Wrapper {
|
||||
// class wrapper map
|
||||
private static final ConcurrentMap<Class<?>, Wrapper> WRAPPER_MAP = new ConcurrentHashMap<>();
|
||||
private static final ConcurrentMap<Class<?>, Wrapper> WRAPPER_MAP =
|
||||
new ConcurrentHashMap<Class<?>, Wrapper>(); // class wrapper map
|
||||
private static final String[] EMPTY_STRING_ARRAY = new String[0];
|
||||
private static final String[] OBJECT_METHODS = new String[] {"getClass", "hashCode", "toString", "equals"};
|
||||
private static final Wrapper OBJECT_WRAPPER = new Wrapper() {
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ public class ClassUtils {
|
|||
}
|
||||
|
||||
public static <K, V> Map<K, V> toMap(Map.Entry<K, V>[] entries) {
|
||||
Map<K, V> map = new HashMap<>();
|
||||
Map<K, V> map = new HashMap<K, V>();
|
||||
if (entries != null && entries.length > 0) {
|
||||
for (Map.Entry<K, V> entry : entries) {
|
||||
map.put(entry.getKey(), entry.getValue());
|
||||
|
|
|
|||
|
|
@ -31,9 +31,10 @@ import java.io.StringReader;
|
|||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
|
|
@ -42,7 +43,6 @@ import java.util.Set;
|
|||
import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_SERVER_SHUTDOWN_TIMEOUT;
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.SHUTDOWN_WAIT_KEY;
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.SHUTDOWN_WAIT_SECONDS_KEY;
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_PROPERTY_TYPE_MISMATCH;
|
||||
|
||||
/**
|
||||
* Utilities for manipulating configurations from different sources
|
||||
|
|
@ -57,18 +57,18 @@ public final class ConfigurationUtils {
|
|||
}
|
||||
|
||||
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(ConfigurationUtils.class);
|
||||
private static final Set<String> securityKey;
|
||||
private static final List<String> securityKey;
|
||||
|
||||
private static volatile long expectedShutdownTime = Long.MAX_VALUE;
|
||||
|
||||
static {
|
||||
Set<String> keys = new HashSet<>();
|
||||
List<String> keys = new LinkedList<>();
|
||||
keys.add("accesslog");
|
||||
keys.add("router");
|
||||
keys.add("rule");
|
||||
keys.add("runtime");
|
||||
keys.add("type");
|
||||
securityKey = Collections.unmodifiableSet(keys);
|
||||
securityKey = Collections.unmodifiableList(keys);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -213,15 +213,11 @@ public final class ConfigurationUtils {
|
|||
properties.load(new StringReader(content));
|
||||
properties.stringPropertyNames().forEach(k -> {
|
||||
boolean deny = false;
|
||||
// check whether property name is safe or not based on the last fragment kebab-case comparison.
|
||||
String[] fragments = k.split("\\.");
|
||||
if (securityKey.contains(StringUtils.convertToSplitName(fragments[fragments.length - 1], "-"))) {
|
||||
deny = true;
|
||||
logger.warn(
|
||||
COMMON_PROPERTY_TYPE_MISMATCH,
|
||||
"security properties are not allowed to be set",
|
||||
"",
|
||||
String.format("'%s' is not allowed to be set as it is on the security key list.", k));
|
||||
for (String key : securityKey) {
|
||||
if (k.contains(key)) {
|
||||
deny = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!deny) {
|
||||
map.put(k, properties.getProperty(k));
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ import java.util.Map;
|
|||
import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_UNEXPECTED_EXCEPTION;
|
||||
|
||||
public class ModuleEnvironment extends Environment implements ModuleExt {
|
||||
|
||||
// delegate
|
||||
|
|
@ -92,13 +94,19 @@ public class ModuleEnvironment extends Environment implements ModuleExt {
|
|||
@Override
|
||||
public Configuration getDynamicGlobalConfiguration() {
|
||||
if (dynamicConfiguration == null) {
|
||||
CompositeConfiguration configuration = new CompositeConfiguration();
|
||||
configuration.addConfiguration(applicationDelegate.getDynamicGlobalConfiguration());
|
||||
configuration.addConfiguration(orderedPropertiesConfiguration);
|
||||
return configuration;
|
||||
return applicationDelegate.getDynamicGlobalConfiguration();
|
||||
}
|
||||
|
||||
if (dynamicGlobalConfiguration == null) {
|
||||
if (dynamicConfiguration == null) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn(
|
||||
COMMON_UNEXPECTED_EXCEPTION,
|
||||
"",
|
||||
"",
|
||||
"dynamicConfiguration is null , return globalConfiguration.");
|
||||
}
|
||||
return getConfiguration();
|
||||
}
|
||||
dynamicGlobalConfiguration = new CompositeConfiguration();
|
||||
dynamicGlobalConfiguration.addConfiguration(dynamicConfiguration);
|
||||
dynamicGlobalConfiguration.addConfiguration(getConfiguration());
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import java.util.concurrent.ExecutorService;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
public interface CommonConstants {
|
||||
|
||||
String DUBBO = "dubbo";
|
||||
|
||||
String TRIPLE = "tri";
|
||||
|
|
@ -268,14 +267,12 @@ public interface CommonConstants {
|
|||
String $INVOKE = "$invoke";
|
||||
|
||||
String $INVOKE_ASYNC = "$invokeAsync";
|
||||
|
||||
String GENERIC_PARAMETER_DESC = "Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;";
|
||||
|
||||
/**
|
||||
* echo call
|
||||
*/
|
||||
String $ECHO = "$echo";
|
||||
|
||||
/**
|
||||
* package version in the manifest
|
||||
*/
|
||||
|
|
@ -286,19 +283,12 @@ public interface CommonConstants {
|
|||
int MAX_PROXY_COUNT = 65535;
|
||||
|
||||
String MONITOR_KEY = "monitor";
|
||||
|
||||
String BACKGROUND_KEY = "background";
|
||||
|
||||
String CLUSTER_KEY = "cluster";
|
||||
|
||||
String USERNAME_KEY = "username";
|
||||
|
||||
String PASSWORD_KEY = "password";
|
||||
|
||||
String HOST_KEY = "host";
|
||||
|
||||
String PORT_KEY = "port";
|
||||
|
||||
String DUBBO_IP_TO_BIND = "DUBBO_IP_TO_BIND";
|
||||
|
||||
/**
|
||||
|
|
@ -318,29 +308,21 @@ public interface CommonConstants {
|
|||
String SHUTDOWN_WAIT_SECONDS_KEY = "dubbo.service.shutdown.wait.seconds";
|
||||
|
||||
String SHUTDOWN_WAIT_KEY = "dubbo.service.shutdown.wait";
|
||||
|
||||
String DUBBO_PROTOCOL = "dubbo";
|
||||
|
||||
String DUBBO_LABELS = "dubbo.labels";
|
||||
|
||||
String DUBBO_ENV_KEYS = "dubbo.env.keys";
|
||||
|
||||
String CONFIG_CONFIGFILE_KEY = "config-file";
|
||||
|
||||
String CONFIG_ENABLE_KEY = "highest-priority";
|
||||
|
||||
String CONFIG_NAMESPACE_KEY = "namespace";
|
||||
|
||||
String CHECK_KEY = "check";
|
||||
|
||||
String BACKLOG_KEY = "backlog";
|
||||
|
||||
String HEARTBEAT_EVENT = null;
|
||||
|
||||
String MOCK_HEARTBEAT_EVENT = "H";
|
||||
|
||||
String READONLY_EVENT = "R";
|
||||
|
||||
String WRITEABLE_EVENT = "W";
|
||||
|
||||
String REFERENCE_FILTER_KEY = "reference.filter";
|
||||
|
|
@ -477,7 +459,6 @@ public interface CommonConstants {
|
|||
String REGISTRY_DELAY_NOTIFICATION_KEY = "delay-notification";
|
||||
|
||||
String CACHE_CLEAR_TASK_INTERVAL = "dubbo.application.url.cache.task.interval";
|
||||
|
||||
String CACHE_CLEAR_WAITING_THRESHOLD = "dubbo.application.url.cache.clear.waiting";
|
||||
|
||||
String CLUSTER_INTERCEPTOR_COMPATIBLE_KEY = "dubbo.application.cluster.interceptor.compatible";
|
||||
|
|
@ -634,18 +615,17 @@ public interface CommonConstants {
|
|||
String SERVICE_EXECUTOR = "service-executor";
|
||||
|
||||
String EXECUTOR_MANAGEMENT_MODE = "executor-management-mode";
|
||||
|
||||
String EXECUTOR_MANAGEMENT_MODE_DEFAULT = "default";
|
||||
|
||||
String EXECUTOR_MANAGEMENT_MODE_ISOLATION = "isolation";
|
||||
|
||||
/**
|
||||
*
|
||||
* used in JVMUtil.java ,Control stack print lines, default is 32 lines
|
||||
*
|
||||
*/
|
||||
String DUBBO_JSTACK_MAXLINE = "dubbo.jstack-dump.max-line";
|
||||
|
||||
String ENCODE_IN_IO_THREAD_KEY = "encode.in.io";
|
||||
|
||||
boolean DEFAULT_ENCODE_IN_IO_THREAD = false;
|
||||
|
||||
/**
|
||||
|
|
@ -666,8 +646,4 @@ public interface CommonConstants {
|
|||
String DUBBO_MANUAL_REGISTER_KEY = "dubbo.application.manual-register";
|
||||
|
||||
String DUBBO2_COMPACT_ENABLE = "dubbo.compact.enable";
|
||||
|
||||
String ZOOKEEPER_ENSEMBLE_TRACKER_KEY = "zookeeper.ensemble.tracker";
|
||||
|
||||
String DUBBO_VERSIONS_KEY = "META-INF/dubbo-versions";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,11 +141,4 @@ public interface RegistryConstants {
|
|||
String ENABLE_EMPTY_PROTECTION_KEY = "enable-empty-protection";
|
||||
boolean DEFAULT_ENABLE_EMPTY_PROTECTION = false;
|
||||
String REGISTER_CONSUMER_URL_KEY = "register-consumer-url";
|
||||
|
||||
/**
|
||||
* export noting suffix servicename
|
||||
* by default, dubbo export servicename is "${interface}:${version}:", this servicename with ':' suffix
|
||||
* for compatible, we should export noting suffix servicename, eg: ${interface}:${version}
|
||||
*/
|
||||
String NACOE_REGISTER_COMPATIBLE = "nacos.register-compatible";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@ import java.util.Map;
|
|||
public interface JSON {
|
||||
boolean isSupport();
|
||||
|
||||
boolean isJson(String json);
|
||||
|
||||
<T> T toJavaObject(String json, Type type);
|
||||
|
||||
<T> List<T> toJavaList(String json, Class<T> clazz);
|
||||
|
|
|
|||
|
|
@ -19,17 +19,9 @@ package org.apache.dubbo.common.json.impl;
|
|||
import java.lang.reflect.Type;
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.fastjson2.JSONValidator;
|
||||
import com.alibaba.fastjson2.JSONWriter;
|
||||
|
||||
public class FastJson2Impl extends AbstractJSONImpl {
|
||||
|
||||
@Override
|
||||
public boolean isJson(String json) {
|
||||
JSONValidator validator = JSONValidator.from(json);
|
||||
return validator.validate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T toJavaObject(String json, Type type) {
|
||||
return com.alibaba.fastjson2.JSON.parseObject(json, type);
|
||||
|
|
|
|||
|
|
@ -23,16 +23,6 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
|
|||
|
||||
public class FastJsonImpl extends AbstractJSONImpl {
|
||||
|
||||
@Override
|
||||
public boolean isJson(String json) {
|
||||
try {
|
||||
Object obj = com.alibaba.fastjson.JSON.parse(json);
|
||||
return obj instanceof com.alibaba.fastjson.JSONObject || obj instanceof com.alibaba.fastjson.JSONArray;
|
||||
} catch (com.alibaba.fastjson.JSONException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T toJavaObject(String json, Type type) {
|
||||
return com.alibaba.fastjson.JSON.parseObject(json, type);
|
||||
|
|
|
|||
|
|
@ -20,25 +20,12 @@ import java.lang.reflect.Type;
|
|||
import java.util.List;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
public class GsonImpl extends AbstractJSONImpl {
|
||||
// weak reference of com.google.gson.Gson, prevent throw exception when init
|
||||
private volatile Object gsonCache = null;
|
||||
|
||||
@Override
|
||||
public boolean isJson(String json) {
|
||||
try {
|
||||
JsonElement jsonElement = JsonParser.parseString(json);
|
||||
return jsonElement.isJsonObject() || jsonElement.isJsonArray();
|
||||
} catch (JsonSyntaxException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T toJavaObject(String json, Type type) {
|
||||
return getGson().fromJson(json, type);
|
||||
|
|
|
|||
|
|
@ -20,9 +20,7 @@ import java.lang.reflect.Type;
|
|||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.MapperFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.json.JsonMapper;
|
||||
|
|
@ -33,16 +31,6 @@ public class JacksonImpl extends AbstractJSONImpl {
|
|||
|
||||
private volatile Object jacksonCache = null;
|
||||
|
||||
@Override
|
||||
public boolean isJson(String json) {
|
||||
try {
|
||||
JsonNode node = objectMapper.readTree(json);
|
||||
return node.isObject() || node.isArray();
|
||||
} catch (JsonProcessingException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T toJavaObject(String json, Type type) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,4 @@ public interface DataStore {
|
|||
void put(String componentName, String key, Object value);
|
||||
|
||||
void remove(String componentName, String key);
|
||||
|
||||
default void addListener(DataStoreUpdateListener dataStoreUpdateListener) {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.dubbo.common.store;
|
||||
|
||||
public interface DataStoreUpdateListener {
|
||||
void onUpdate(String componentName, String key, Object value);
|
||||
}
|
||||
|
|
@ -16,13 +16,8 @@
|
|||
*/
|
||||
package org.apache.dubbo.common.store.support;
|
||||
|
||||
import org.apache.dubbo.common.constants.LoggerCodeConstants;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.store.DataStore;
|
||||
import org.apache.dubbo.common.store.DataStoreUpdateListener;
|
||||
import org.apache.dubbo.common.utils.ConcurrentHashMapUtils;
|
||||
import org.apache.dubbo.common.utils.ConcurrentHashSet;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
@ -30,11 +25,9 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
public class SimpleDataStore implements DataStore {
|
||||
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(SimpleDataStore.class);
|
||||
|
||||
// <component name or id, <data-name, data-value>>
|
||||
private final ConcurrentMap<String, ConcurrentMap<String, Object>> data = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashSet<DataStoreUpdateListener> listeners = new ConcurrentHashSet<>();
|
||||
|
||||
@Override
|
||||
public Map<String, Object> get(String componentName) {
|
||||
|
|
@ -59,7 +52,6 @@ public class SimpleDataStore implements DataStore {
|
|||
Map<String, Object> componentData =
|
||||
ConcurrentHashMapUtils.computeIfAbsent(data, componentName, k -> new ConcurrentHashMap<>());
|
||||
componentData.put(key, value);
|
||||
notifyListeners(componentName, key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -68,27 +60,5 @@ public class SimpleDataStore implements DataStore {
|
|||
return;
|
||||
}
|
||||
data.get(componentName).remove(key);
|
||||
notifyListeners(componentName, key, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(DataStoreUpdateListener dataStoreUpdateListener) {
|
||||
listeners.add(dataStoreUpdateListener);
|
||||
}
|
||||
|
||||
private void notifyListeners(String componentName, String key, Object value) {
|
||||
for (DataStoreUpdateListener listener : listeners) {
|
||||
try {
|
||||
listener.onUpdate(componentName, key, value);
|
||||
} catch (Throwable t) {
|
||||
logger.warn(
|
||||
LoggerCodeConstants.INTERNAL_ERROR,
|
||||
"",
|
||||
"",
|
||||
"Failed to notify data store update listener. " + "ComponentName: " + componentName + " Key: "
|
||||
+ key,
|
||||
t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public final class InternalThreadLocalMap {
|
|||
|
||||
private Object[] indexedVariables;
|
||||
|
||||
private static ThreadLocal<InternalThreadLocalMap> slowThreadLocalMap = new ThreadLocal<>();
|
||||
private static ThreadLocal<InternalThreadLocalMap> slowThreadLocalMap = new ThreadLocal<InternalThreadLocalMap>();
|
||||
|
||||
private static final AtomicInteger NEXT_INDEX = new AtomicInteger();
|
||||
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ public class AbortPolicyWithReport extends ThreadPoolExecutor.AbortPolicy {
|
|||
// 0-1 - Thread pool is EXHAUSTED!
|
||||
logger.warn(COMMON_THREAD_POOL_EXHAUSTED, "too much client requesting provider", "", msg);
|
||||
|
||||
if (Boolean.parseBoolean(url.getParameter(DUMP_ENABLE, Boolean.TRUE.toString()))) {
|
||||
if (Boolean.parseBoolean(url.getParameter(DUMP_ENABLE, "true"))) {
|
||||
dumpJStack();
|
||||
}
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ public class AbortPolicyWithReport extends ThreadPoolExecutor.AbortPolicy {
|
|||
});
|
||||
} finally {
|
||||
guard.release();
|
||||
// must shut down thread pool ,if not will lead to OOM
|
||||
// must shutdown thread pool ,if not will lead to OOM
|
||||
if (pool != null) {
|
||||
pool.shutdown();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -427,7 +427,7 @@ public class HashedWheelTimer implements Timer {
|
|||
}
|
||||
|
||||
private final class Worker implements Runnable {
|
||||
private final Set<Timeout> unprocessedTimeouts = new HashSet<>();
|
||||
private final Set<Timeout> unprocessedTimeouts = new HashSet<Timeout>();
|
||||
|
||||
private long tick;
|
||||
|
||||
|
|
|
|||
|
|
@ -113,12 +113,12 @@ public class ServiceConfigURL extends URL {
|
|||
}
|
||||
|
||||
@Override
|
||||
public URL addAttributes(Map<String, Object> attributeMap) {
|
||||
public URL addAttributes(Map<String, Object> attributes) {
|
||||
Map<String, Object> newAttributes = new HashMap<>();
|
||||
if (this.attributes != null) {
|
||||
newAttributes.putAll(this.attributes);
|
||||
}
|
||||
newAttributes.putAll(attributeMap);
|
||||
newAttributes.putAll(attributes);
|
||||
return new ServiceConfigURL(getUrlAddress(), getUrlParam(), newAttributes);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public class CIDRUtils {
|
|||
|
||||
private byte[] toBytes(byte[] array, int targetSize) {
|
||||
int counter = 0;
|
||||
List<Byte> newArr = new ArrayList<>();
|
||||
List<Byte> newArr = new ArrayList<Byte>();
|
||||
while (counter < targetSize && (array.length - 1 - counter >= 0)) {
|
||||
newArr.add(0, array[array.length - 1 - counter]);
|
||||
counter++;
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ public class ConfigUtils {
|
|||
*/
|
||||
public static List<String> mergeValues(
|
||||
ExtensionDirector extensionDirector, Class<?> type, String cfg, List<String> def) {
|
||||
List<String> defaults = new ArrayList<>();
|
||||
List<String> defaults = new ArrayList<String>();
|
||||
if (def != null) {
|
||||
for (String name : def) {
|
||||
if (extensionDirector.getExtensionLoader(type).hasExtension(name)) {
|
||||
|
|
@ -96,7 +96,7 @@ public class ConfigUtils {
|
|||
}
|
||||
}
|
||||
|
||||
List<String> names = new ArrayList<>();
|
||||
List<String> names = new ArrayList<String>();
|
||||
|
||||
// add initial values
|
||||
String[] configs = (cfg == null || cfg.trim().length() == 0) ? new String[0] : COMMA_SPLIT_PATTERN.split(cfg);
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ public class IOUtils {
|
|||
* @throws IOException If an I/O error occurs
|
||||
*/
|
||||
public static String[] readLines(InputStream is) throws IOException {
|
||||
List<String> lines = new ArrayList<>();
|
||||
List<String> lines = new ArrayList<String>();
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
|
|
|
|||
|
|
@ -146,8 +146,4 @@ public class JsonUtils {
|
|||
public static List<String> checkStringList(List<?> rawList) {
|
||||
return getJson().checkStringList(rawList);
|
||||
}
|
||||
|
||||
public static boolean checkJson(String json) {
|
||||
return getJson().isJson(json);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.dubbo.common.utils;
|
||||
|
||||
import org.apache.dubbo.common.constants.LoggerCodeConstants;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
|
||||
public class LockUtils {
|
||||
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(LockUtils.class);
|
||||
|
||||
public static final int DEFAULT_TIMEOUT = 60_000;
|
||||
|
||||
public static void safeLock(Lock lock, int timeout, Runnable runnable) {
|
||||
try {
|
||||
if (!lock.tryLock(timeout, TimeUnit.MILLISECONDS)) {
|
||||
logger.error(
|
||||
LoggerCodeConstants.INTERNAL_ERROR,
|
||||
"",
|
||||
"",
|
||||
"Try to lock failed, timeout: " + timeout,
|
||||
new TimeoutException());
|
||||
}
|
||||
runnable.run();
|
||||
} catch (InterruptedException e) {
|
||||
logger.warn(LoggerCodeConstants.INTERNAL_ERROR, "", "", "Try to lock failed", e);
|
||||
Thread.currentThread().interrupt();
|
||||
} finally {
|
||||
try {
|
||||
lock.unlock();
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -26,7 +26,7 @@ import java.util.List;
|
|||
public class Stack<E> {
|
||||
private int mSize = 0;
|
||||
|
||||
private final List<E> mElements = new ArrayList<>();
|
||||
private final List<E> mElements = new ArrayList<E>();
|
||||
|
||||
public Stack() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -861,7 +861,7 @@ public final class StringUtils {
|
|||
*/
|
||||
private static Map<String, String> parseKeyValuePair(String str, String itemSeparator) {
|
||||
String[] tmp = str.split(itemSeparator);
|
||||
Map<String, String> map = new HashMap<>(tmp.length);
|
||||
Map<String, String> map = new HashMap<String, String>(tmp.length);
|
||||
for (int i = 0; i < tmp.length; i++) {
|
||||
Matcher matcher = KVP_PATTERN.matcher(tmp[i]);
|
||||
if (!matcher.matches()) {
|
||||
|
|
@ -885,7 +885,7 @@ public final class StringUtils {
|
|||
*/
|
||||
public static Map<String, String> parseQueryString(String qs) {
|
||||
if (isEmpty(qs)) {
|
||||
return new HashMap<>();
|
||||
return new HashMap<String, String>();
|
||||
}
|
||||
return parseKeyValuePair(qs, "\\&");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ public class UrlUtils {
|
|||
throw new IllegalArgumentException(
|
||||
"Addresses is not allowed to be empty, please re-enter."); // here won't be empty
|
||||
}
|
||||
List<URL> registries = new ArrayList<>();
|
||||
List<URL> registries = new ArrayList<URL>();
|
||||
for (String addr : addresses) {
|
||||
registries.add(parseURL(addr, defaults));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ public abstract class AbstractInterfaceConfig extends AbstractMethodConfig {
|
|||
/**
|
||||
* The url of the reference service
|
||||
*/
|
||||
protected final transient List<URL> urls = new ArrayList<>();
|
||||
protected final transient List<URL> urls = new ArrayList<URL>();
|
||||
|
||||
@Transient
|
||||
public List<URL> getExportedUrls() {
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ public class ApplicationConfig extends AbstractConfig {
|
|||
}
|
||||
|
||||
public void setRegistry(RegistryConfig registry) {
|
||||
List<RegistryConfig> registries = new ArrayList<>(1);
|
||||
List<RegistryConfig> registries = new ArrayList<RegistryConfig>(1);
|
||||
registries.add(registry);
|
||||
this.registries = registries;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,11 +149,7 @@ public interface Constants {
|
|||
|
||||
String SERVER_THREAD_POOL_NAME = "DubboServerHandler";
|
||||
|
||||
String SERVER_THREAD_POOL_PREFIX = SERVER_THREAD_POOL_NAME + "-";
|
||||
|
||||
String CLIENT_THREAD_POOL_NAME = "DubboClientHandler";
|
||||
|
||||
String CLIENT_THREAD_POOL_PREFIX = CLIENT_THREAD_POOL_NAME + "-";
|
||||
|
||||
String REST_PROTOCOL = "rest";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ public class ModuleConfig extends AbstractConfig {
|
|||
}
|
||||
|
||||
public void setRegistry(RegistryConfig registry) {
|
||||
List<RegistryConfig> registries = new ArrayList<>(1);
|
||||
List<RegistryConfig> registries = new ArrayList<RegistryConfig>(1);
|
||||
registries.add(registry);
|
||||
this.registries = registries;
|
||||
}
|
||||
|
|
@ -218,7 +218,7 @@ public class ModuleConfig extends AbstractConfig {
|
|||
|
||||
/**
|
||||
* Whether start module in background.
|
||||
* If start in background, do not await finish on Spring ContextRefreshedEvent.
|
||||
* If start in backgound, do not await finish on Spring ContextRefreshedEvent.
|
||||
*
|
||||
* @see org.apache.dubbo.config.spring.context.DubboDeployApplicationListener
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.EXTRA_KEYS_KEY;
|
|||
import static org.apache.dubbo.common.constants.CommonConstants.SHUTDOWN_WAIT_KEY;
|
||||
import static org.apache.dubbo.common.constants.RegistryConstants.ENABLE_EMPTY_PROTECTION_KEY;
|
||||
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTER_MODE_KEY;
|
||||
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_CLUSTER_KEY;
|
||||
import static org.apache.dubbo.common.constants.RemotingConstants.BACKUP_KEY;
|
||||
import static org.apache.dubbo.common.utils.PojoUtils.updatePropertyIfAbsent;
|
||||
|
||||
|
|
@ -220,6 +221,7 @@ public class RegistryConfig extends AbstractConfig {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Parameter(key = REGISTRY_CLUSTER_KEY)
|
||||
public String getId() {
|
||||
return super.getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public final class ClassUtils {
|
|||
* @return methods list
|
||||
*/
|
||||
public static List<Method> getPublicNonStaticMethods(final Class<?> clazz) {
|
||||
List<Method> result = new ArrayList<>();
|
||||
List<Method> result = new ArrayList<Method>();
|
||||
|
||||
Method[] methods = clazz.getMethods();
|
||||
for (Method method : methods) {
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ public class ProviderModel extends ServiceModel {
|
|||
}
|
||||
|
||||
public List<ProviderMethodModel> getAllMethodModels() {
|
||||
List<ProviderMethodModel> result = new ArrayList<>();
|
||||
List<ProviderMethodModel> result = new ArrayList<ProviderMethodModel>();
|
||||
for (List<ProviderMethodModel> models : methods.values()) {
|
||||
result.addAll(models);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,6 +190,7 @@ org.thymeleaf.
|
|||
org.yaml.snakeyaml.tokens.
|
||||
pstore.shaded.org.apache.commons.collections.
|
||||
sun.print.
|
||||
sun.rmi.
|
||||
sun.rmi.server.
|
||||
sun.rmi.transport.
|
||||
weblogic.ejb20.internal.
|
||||
weblogic.jms.common.
|
||||
|
|
|
|||
|
|
@ -1132,22 +1132,4 @@ class URLTest {
|
|||
assertEquals(20881, url.getPort());
|
||||
assertEquals("apache", url.getParameter("name"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testToServiceString() {
|
||||
URL url = URL.valueOf(
|
||||
"zookeeper://10.20.130.230:4444/org.apache.dubbo.metadata.report.MetadataReport?version=1.0.0&application=vic&group=aaa");
|
||||
assertEquals(
|
||||
"zookeeper://10.20.130.230:4444/aaa/org.apache.dubbo.metadata.report.MetadataReport:1.0.0",
|
||||
url.toServiceString());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testToServiceStringWithParameters() {
|
||||
URL url = URL.valueOf(
|
||||
"zookeeper://10.20.130.230:4444/org.apache.dubbo.metadata.report.MetadataReport?version=1.0.0&application=vic&group=aaa&namespace=test");
|
||||
assertEquals(
|
||||
"zookeeper://10.20.130.230:4444/aaa/org.apache.dubbo.metadata.report.MetadataReport:1.0.0?namespace=test",
|
||||
url.toServiceString("namespace"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import java.lang.reflect.Method;
|
|||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import javassist.ClassPool;
|
||||
|
||||
|
|
@ -57,8 +56,7 @@ class ClassGeneratorTest {
|
|||
ClassGenerator cg = ClassGenerator.newInstance();
|
||||
|
||||
// add className, interface, superClass
|
||||
String className = BaseClass.class.getPackage().getName() + ".TestClass"
|
||||
+ UUID.randomUUID().toString().replace("-", "");
|
||||
String className = BaseClass.class.getPackage().getName() + ".TestClass";
|
||||
cg.setClassName(className);
|
||||
cg.addInterface(BaseInterface.class);
|
||||
cg.setSuperClass(BaseClass.class);
|
||||
|
|
@ -186,7 +184,7 @@ class ClassGeneratorTest {
|
|||
fname.setAccessible(true);
|
||||
|
||||
ClassGenerator cg = ClassGenerator.newInstance();
|
||||
cg.setClassName(Bean.class.getName() + "$Builder" + UUID.randomUUID().toString());
|
||||
cg.setClassName(Bean.class.getName() + "$Builder");
|
||||
cg.addInterface(Builder.class);
|
||||
|
||||
cg.addField("public static java.lang.reflect.Field FNAME;");
|
||||
|
|
@ -213,7 +211,7 @@ class ClassGeneratorTest {
|
|||
fname.setAccessible(true);
|
||||
|
||||
ClassGenerator cg = ClassGenerator.newInstance();
|
||||
cg.setClassName(Bean.class.getName() + "$Builder2" + UUID.randomUUID().toString());
|
||||
cg.setClassName(Bean.class.getName() + "$Builder2");
|
||||
cg.addInterface(Builder.class);
|
||||
|
||||
cg.addField("FNAME", Modifier.PUBLIC | Modifier.STATIC, java.lang.reflect.Field.class);
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
package org.apache.dubbo.common.config;
|
||||
|
||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||
import org.apache.dubbo.rpc.model.FrameworkModel;
|
||||
import org.apache.dubbo.rpc.model.ModuleModel;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
|
@ -34,18 +32,4 @@ class OrderedPropertiesConfigurationTest {
|
|||
ApplicationModel.defaultModel().getDefaultModule());
|
||||
Assertions.assertEquals("999", configuration.getInternalProperty("testKey"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetPropertyFromOrderedPropertiesConfiguration() {
|
||||
FrameworkModel frameworkModel = new FrameworkModel();
|
||||
|
||||
ApplicationModel applicationModel = frameworkModel.newApplication();
|
||||
|
||||
ModuleModel moduleModel = applicationModel.newModule();
|
||||
ModuleEnvironment moduleEnvironment = moduleModel.modelEnvironment();
|
||||
|
||||
Configuration configuration = moduleEnvironment.getDynamicGlobalConfiguration();
|
||||
// MockOrderedPropertiesProvider2 initProperties
|
||||
Assertions.assertEquals("999", configuration.getString("testKey"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ class ExtensionDirectorTest {
|
|||
// 2. Child ExtensionDirector can get extension instance from parent
|
||||
// 3. Parent ExtensionDirector can't get extension instance from child
|
||||
|
||||
ExtensionDirector fwExtensionDirector = FrameworkModel.defaultModel().getExtensionDirector();
|
||||
ExtensionDirector fwExtensionDirector =
|
||||
new ExtensionDirector(null, ExtensionScope.FRAMEWORK, FrameworkModel.defaultModel());
|
||||
ExtensionDirector appExtensionDirector =
|
||||
new ExtensionDirector(fwExtensionDirector, ExtensionScope.APPLICATION, ApplicationModel.defaultModel());
|
||||
ExtensionDirector moduleExtensionDirector = new ExtensionDirector(
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ class GsonUtilsTest {
|
|||
Assertions.fail();
|
||||
} catch (RuntimeException ex) {
|
||||
Assertions.assertEquals(
|
||||
"Generic serialization [gson] Json syntax exception thrown when parsing (message:{'name':'Tom','age':} type:class org.apache.dubbo.common.json.GsonUtilsTest$User) error:com.google.gson.stream.MalformedJsonException: Expected value at line 1 column 21 path $.age\n"
|
||||
+ "See https://github.com/google/gson/blob/main/Troubleshooting.md#malformed-json",
|
||||
"Generic serialization [gson] Json syntax exception thrown when parsing (message:{'name':'Tom','age':} type:class org.apache.dubbo.common.json.GsonUtilsTest$User) error:com.google.gson.stream.MalformedJsonException: Expected value at line 1 column 21 path $.age",
|
||||
ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,13 +16,9 @@
|
|||
*/
|
||||
package org.apache.dubbo.common.store.support;
|
||||
|
||||
import org.apache.dubbo.common.store.DataStoreUpdateListener;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
|
|
@ -61,30 +57,4 @@ class SimpleDataStoreTest {
|
|||
dataStore.remove("component", "key");
|
||||
assertNotEquals(map, dataStore.get("component"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testNotify() {
|
||||
DataStoreUpdateListener listener = Mockito.mock(DataStoreUpdateListener.class);
|
||||
dataStore.addListener(listener);
|
||||
|
||||
ArgumentCaptor<String> componentNameCaptor = ArgumentCaptor.forClass(String.class);
|
||||
ArgumentCaptor<String> keyCaptor = ArgumentCaptor.forClass(String.class);
|
||||
ArgumentCaptor<Object> valueCaptor = ArgumentCaptor.forClass(Object.class);
|
||||
|
||||
dataStore.put("name", "key", "1");
|
||||
Mockito.verify(listener).onUpdate(componentNameCaptor.capture(), keyCaptor.capture(), valueCaptor.capture());
|
||||
assertEquals("name", componentNameCaptor.getValue());
|
||||
assertEquals("key", keyCaptor.getValue());
|
||||
assertEquals("1", valueCaptor.getValue());
|
||||
|
||||
dataStore.remove("name", "key");
|
||||
Mockito.verify(listener, Mockito.times(2))
|
||||
.onUpdate(componentNameCaptor.capture(), keyCaptor.capture(), valueCaptor.capture());
|
||||
assertEquals("name", componentNameCaptor.getValue());
|
||||
assertEquals("key", keyCaptor.getValue());
|
||||
assertNull(valueCaptor.getValue());
|
||||
|
||||
dataStore.remove("name2", "key");
|
||||
Mockito.verify(listener, Mockito.times(0)).onUpdate("name2", "key", null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,49 +63,6 @@ class JsonUtilsTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testIsJson() {
|
||||
JsonUtils.setJson(null);
|
||||
// prefer use fastjson2
|
||||
System.setProperty("dubbo.json-framework.prefer", "fastjson2");
|
||||
Assertions.assertTrue(
|
||||
JsonUtils.getJson().isJson("{\"title\":\"Java Programming\",\"author\":\"John Doe\",\"pages\":300}"));
|
||||
Assertions.assertFalse(JsonUtils.getJson().isJson("This is not a JSON string"));
|
||||
Assertions.assertTrue(
|
||||
JsonUtils.getJson().isJson("[{\"title\":\"Java Programming\"}, {\"title\":\"Python Programming\"}]"));
|
||||
System.clearProperty("dubbo.json-framework.prefer");
|
||||
|
||||
// prefer use fastjson
|
||||
JsonUtils.setJson(null);
|
||||
System.setProperty("dubbo.json-framework.prefer", "fastjson");
|
||||
Assertions.assertTrue(
|
||||
JsonUtils.getJson().isJson("{\"title\":\"Java Programming\",\"author\":\"John Doe\",\"pages\":300}"));
|
||||
Assertions.assertFalse(JsonUtils.getJson().isJson("This is not a JSON string"));
|
||||
Assertions.assertTrue(
|
||||
JsonUtils.getJson().isJson("[{\"title\":\"Java Programming\"}, {\"title\":\"Python Programming\"}]"));
|
||||
System.clearProperty("dubbo.json-framework.prefer");
|
||||
|
||||
// prefer use gson
|
||||
JsonUtils.setJson(null);
|
||||
System.setProperty("dubbo.json-framework.prefer", "gson");
|
||||
Assertions.assertTrue(
|
||||
JsonUtils.getJson().isJson("{\"title\":\"Java Programming\",\"author\":\"John Doe\",\"pages\":300}"));
|
||||
Assertions.assertFalse(JsonUtils.getJson().isJson("This is not a JSON string"));
|
||||
Assertions.assertTrue(
|
||||
JsonUtils.getJson().isJson("[{\"title\":\"Java Programming\"}, {\"title\":\"Python Programming\"}]"));
|
||||
System.clearProperty("dubbo.json-framework.prefer");
|
||||
|
||||
// prefer use jackson
|
||||
JsonUtils.setJson(null);
|
||||
System.setProperty("dubbo.json-framework.prefer", "jackson");
|
||||
Assertions.assertTrue(
|
||||
JsonUtils.getJson().isJson("{\"title\":\"Java Programming\",\"author\":\"John Doe\",\"pages\":300}"));
|
||||
Assertions.assertFalse(JsonUtils.getJson().isJson("This is not a JSON string"));
|
||||
Assertions.assertTrue(
|
||||
JsonUtils.getJson().isJson("[{\"title\":\"Java Programming\"}, {\"title\":\"Python Programming\"}]"));
|
||||
System.clearProperty("dubbo.json-framework.prefer");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetJson1() {
|
||||
Assertions.assertNotNull(JsonUtils.getJson());
|
||||
|
|
|
|||
|
|
@ -1,144 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.dubbo.common.utils;
|
||||
|
||||
import java.lang.Thread.State;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.RepeatedTest;
|
||||
|
||||
import static org.awaitility.Awaitility.await;
|
||||
|
||||
public class LockUtilsTest {
|
||||
@RepeatedTest(5)
|
||||
void testLockFailed() {
|
||||
ReentrantLock reentrantLock = new ReentrantLock();
|
||||
AtomicBoolean releaseLock = new AtomicBoolean(false);
|
||||
new Thread(() -> {
|
||||
reentrantLock.lock();
|
||||
while (!releaseLock.get()) {
|
||||
try {
|
||||
Thread.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
reentrantLock.unlock();
|
||||
})
|
||||
.start();
|
||||
|
||||
await().until(reentrantLock::isLocked);
|
||||
|
||||
AtomicLong lockTime = new AtomicLong(0);
|
||||
long startTime = System.currentTimeMillis();
|
||||
LockUtils.safeLock(reentrantLock, 1000, () -> {
|
||||
lockTime.set(System.currentTimeMillis());
|
||||
});
|
||||
Assertions.assertTrue(lockTime.get() - startTime >= 1000);
|
||||
releaseLock.set(true);
|
||||
|
||||
while (reentrantLock.isLocked()) {
|
||||
try {
|
||||
Thread.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
lockTime.set(0);
|
||||
startTime = System.currentTimeMillis();
|
||||
LockUtils.safeLock(reentrantLock, 1000, () -> {
|
||||
lockTime.set(System.currentTimeMillis());
|
||||
});
|
||||
Assertions.assertTrue(lockTime.get() - startTime < 1000);
|
||||
}
|
||||
|
||||
@RepeatedTest(5)
|
||||
void testReentrant() {
|
||||
ReentrantLock reentrantLock = new ReentrantLock();
|
||||
reentrantLock.lock();
|
||||
|
||||
AtomicLong lockTime = new AtomicLong(0);
|
||||
long startTime = System.currentTimeMillis();
|
||||
LockUtils.safeLock(reentrantLock, 1000, () -> {
|
||||
lockTime.set(System.currentTimeMillis());
|
||||
});
|
||||
Assertions.assertTrue(lockTime.get() - startTime < 1000);
|
||||
|
||||
reentrantLock.lock();
|
||||
lockTime.set(0);
|
||||
startTime = System.currentTimeMillis();
|
||||
LockUtils.safeLock(reentrantLock, 1000, () -> {
|
||||
lockTime.set(System.currentTimeMillis());
|
||||
});
|
||||
Assertions.assertTrue(lockTime.get() - startTime < 1000);
|
||||
|
||||
Assertions.assertTrue(reentrantLock.isLocked());
|
||||
reentrantLock.unlock();
|
||||
Assertions.assertTrue(reentrantLock.isLocked());
|
||||
reentrantLock.unlock();
|
||||
Assertions.assertFalse(reentrantLock.isLocked());
|
||||
}
|
||||
|
||||
@RepeatedTest(5)
|
||||
void testInterrupt() {
|
||||
ReentrantLock reentrantLock = new ReentrantLock();
|
||||
reentrantLock.lock();
|
||||
|
||||
AtomicBoolean locked = new AtomicBoolean(false);
|
||||
Thread thread = new Thread(() -> {
|
||||
LockUtils.safeLock(reentrantLock, 10000, () -> {
|
||||
locked.set(true);
|
||||
});
|
||||
});
|
||||
thread.start();
|
||||
|
||||
await().until(() -> thread.getState() == State.TIMED_WAITING);
|
||||
thread.interrupt();
|
||||
await().until(() -> thread.getState() == State.TERMINATED);
|
||||
|
||||
Assertions.assertFalse(locked.get());
|
||||
|
||||
reentrantLock.unlock();
|
||||
}
|
||||
|
||||
@RepeatedTest(5)
|
||||
void testHoldLock() throws InterruptedException {
|
||||
ReentrantLock reentrantLock = new ReentrantLock();
|
||||
reentrantLock.lock();
|
||||
|
||||
AtomicLong lockTime = new AtomicLong(0);
|
||||
long startTime = System.currentTimeMillis();
|
||||
Thread thread = new Thread(() -> {
|
||||
LockUtils.safeLock(reentrantLock, 10000, () -> {
|
||||
lockTime.set(System.currentTimeMillis());
|
||||
});
|
||||
});
|
||||
thread.start();
|
||||
|
||||
await().until(() -> thread.getState() == State.TIMED_WAITING);
|
||||
Thread.sleep(1000);
|
||||
reentrantLock.unlock();
|
||||
|
||||
await().until(() -> thread.getState() == State.TERMINATED);
|
||||
Assertions.assertTrue(lockTime.get() - startTime > 1000);
|
||||
Assertions.assertTrue(lockTime.get() - startTime < 10000);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,6 @@
|
|||
package org.apache.dubbo.common.version;
|
||||
|
||||
import org.apache.dubbo.common.Version;
|
||||
import org.apache.dubbo.common.constants.CommonConstants;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
|
@ -111,7 +110,7 @@ class VersionTest {
|
|||
ClassLoader classLoader = new ClassLoader(originClassLoader) {
|
||||
@Override
|
||||
public Class<?> loadClass(String name) throws ClassNotFoundException {
|
||||
if ("org.apache.dubbo.common.Version".equals(name)) {
|
||||
if (name.equals("org.apache.dubbo.common.Version")) {
|
||||
return findClass(name);
|
||||
}
|
||||
return super.loadClass(name);
|
||||
|
|
@ -146,13 +145,15 @@ class VersionTest {
|
|||
|
||||
@Override
|
||||
public Enumeration<URL> getResources(String name) throws IOException {
|
||||
if (name.equals(CommonConstants.DUBBO_VERSIONS_KEY + "/dubbo-common")) {
|
||||
|
||||
if (name.equals("META-INF/versions/dubbo-common")) {
|
||||
return super.getResources("META-INF/test-versions/dubbo-common");
|
||||
}
|
||||
return super.getResources(name);
|
||||
}
|
||||
};
|
||||
return classLoader.loadClass("org.apache.dubbo.common.Version");
|
||||
Class<?> versionClass = classLoader.loadClass("org.apache.dubbo.common.Version");
|
||||
return versionClass;
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.METHOD_KEY;
|
|||
@Deprecated
|
||||
public abstract class AbstractCacheFactory implements CacheFactory {
|
||||
|
||||
private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<>();
|
||||
private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<String, Cache>();
|
||||
|
||||
@Override
|
||||
public Cache getCache(URL url, Invocation invocation) {
|
||||
|
|
|
|||
|
|
@ -854,8 +854,8 @@ public class DelegateURL extends com.alibaba.dubbo.common.URL {
|
|||
}
|
||||
|
||||
@Override
|
||||
public org.apache.dubbo.common.URL addAttributes(Map<String, Object> attributeMap) {
|
||||
return apacheUrl.addAttributes(attributeMap);
|
||||
public org.apache.dubbo.common.URL addAttributes(Map<String, Object> attributes) {
|
||||
return apacheUrl.addAttributes(attributes);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public class ServiceConfig<T> extends org.apache.dubbo.config.ServiceConfig<T> {
|
|||
if (providers == null || providers.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
List<ProtocolConfig> protocols = new ArrayList<>(providers.size());
|
||||
List<ProtocolConfig> protocols = new ArrayList<ProtocolConfig>(providers.size());
|
||||
for (ProviderConfig provider : providers) {
|
||||
protocols.add(convertProviderToProtocol(provider));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ public class Page {
|
|||
}
|
||||
|
||||
private static List<List<String>> stringToList(String str) {
|
||||
List<List<String>> rows = new ArrayList<>();
|
||||
List<String> row = new ArrayList<>();
|
||||
List<List<String>> rows = new ArrayList<List<String>>();
|
||||
List<String> row = new ArrayList<String>();
|
||||
row.add(str);
|
||||
rows.add(row);
|
||||
return rows;
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ public class PageServlet extends HttpServlet {
|
|||
private static final long serialVersionUID = -8370312705453328501L;
|
||||
private static PageServlet INSTANCE;
|
||||
protected final Random random = new Random();
|
||||
protected final Map<String, PageHandler> pages = new ConcurrentHashMap<>();
|
||||
protected final List<PageHandler> menus = new ArrayList<>();
|
||||
protected final Map<String, PageHandler> pages = new ConcurrentHashMap<String, PageHandler>();
|
||||
protected final List<PageHandler> menus = new ArrayList<PageHandler>();
|
||||
|
||||
public static PageServlet getInstance() {
|
||||
return INSTANCE;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class ResourceFilter implements Filter {
|
|||
|
||||
private final long start = System.currentTimeMillis();
|
||||
|
||||
private final List<String> resources = new ArrayList<>();
|
||||
private final List<String> resources = new ArrayList<String>();
|
||||
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
String config = filterConfig.getInitParameter("resources");
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ public class HomePageHandler implements PageHandler {
|
|||
|
||||
@Override
|
||||
public Page handle(URL url) {
|
||||
List<List<String>> rows = new ArrayList<>();
|
||||
List<List<String>> rows = new ArrayList<List<String>>();
|
||||
for (PageHandler handler : PageServlet.getInstance().getMenus()) {
|
||||
String uri = ExtensionLoader.getExtensionLoader(PageHandler.class).getExtensionName(handler);
|
||||
Menu menu = handler.getClass().getAnnotation(Menu.class);
|
||||
List<String> row = new ArrayList<>();
|
||||
List<String> row = new ArrayList<String>();
|
||||
row.add("<a href=\"" + uri + ".html\">" + menu.name() + "</a>");
|
||||
row.add(menu.desc());
|
||||
rows.add(row);
|
||||
|
|
|
|||
|
|
@ -97,8 +97,8 @@ public class LogPageHandler implements PageHandler {
|
|||
}
|
||||
}
|
||||
Level level = LogManager.getRootLogger().getLevel();
|
||||
List<List<String>> rows = new ArrayList<>();
|
||||
List<String> row = new ArrayList<>();
|
||||
List<List<String>> rows = new ArrayList<List<String>>();
|
||||
List<String> row = new ArrayList<String>();
|
||||
row.add(content);
|
||||
rows.add(row);
|
||||
return new Page(
|
||||
|
|
|
|||
|
|
@ -40,14 +40,14 @@ public class StatusPageHandler implements PageHandler {
|
|||
|
||||
@Override
|
||||
public Page handle(URL url) {
|
||||
List<List<String>> rows = new ArrayList<>();
|
||||
List<List<String>> rows = new ArrayList<List<String>>();
|
||||
Set<String> names =
|
||||
ExtensionLoader.getExtensionLoader(StatusChecker.class).getSupportedExtensions();
|
||||
Map<String, Status> statuses = new HashMap<>();
|
||||
Map<String, Status> statuses = new HashMap<String, Status>();
|
||||
for (String name : names) {
|
||||
StatusChecker checker =
|
||||
ExtensionLoader.getExtensionLoader(StatusChecker.class).getExtension(name);
|
||||
List<String> row = new ArrayList<>();
|
||||
List<String> row = new ArrayList<String>();
|
||||
row.add(name);
|
||||
Status status = checker.check();
|
||||
if (status != null && !Status.Level.UNKNOWN.equals(status.getLevel())) {
|
||||
|
|
@ -61,7 +61,7 @@ public class StatusPageHandler implements PageHandler {
|
|||
if ("status".equals(url.getPath())) {
|
||||
return new Page("", "", "", status.getLevel().toString());
|
||||
} else {
|
||||
List<String> row = new ArrayList<>();
|
||||
List<String> row = new ArrayList<String>();
|
||||
row.add("summary");
|
||||
row.add(getLevelHtml(status.getLevel()));
|
||||
row.add("<a href=\"/status\" target=\"_blank\">summary</a>");
|
||||
|
|
|
|||
|
|
@ -44,49 +44,49 @@ public class SystemPageHandler implements PageHandler {
|
|||
|
||||
@Override
|
||||
public Page handle(URL url) {
|
||||
List<List<String>> rows = new ArrayList<>();
|
||||
List<List<String>> rows = new ArrayList<List<String>>();
|
||||
List<String> row;
|
||||
|
||||
row = new ArrayList<>();
|
||||
row = new ArrayList<String>();
|
||||
row.add("Version");
|
||||
row.add(Version.getVersion(SystemPageHandler.class, "2.0.0"));
|
||||
rows.add(row);
|
||||
|
||||
row = new ArrayList<>();
|
||||
row = new ArrayList<String>();
|
||||
row.add("Host");
|
||||
String address = NetUtils.getLocalHost();
|
||||
row.add(NetUtils.getHostName(address) + "/" + address);
|
||||
rows.add(row);
|
||||
|
||||
row = new ArrayList<>();
|
||||
row = new ArrayList<String>();
|
||||
row.add("OS");
|
||||
row.add(System.getProperty("os.name") + " " + System.getProperty("os.version"));
|
||||
rows.add(row);
|
||||
|
||||
row = new ArrayList<>();
|
||||
row = new ArrayList<String>();
|
||||
row.add("JVM");
|
||||
row.add(System.getProperty("java.runtime.name") + " " + System.getProperty("java.runtime.version") + ",<br/>"
|
||||
+ System.getProperty("java.vm.name") + " " + System.getProperty("java.vm.version") + " "
|
||||
+ System.getProperty("java.vm.info", ""));
|
||||
rows.add(row);
|
||||
|
||||
row = new ArrayList<>();
|
||||
row = new ArrayList<String>();
|
||||
row.add("CPU");
|
||||
row.add(System.getProperty("os.arch", "") + ", "
|
||||
+ String.valueOf(Runtime.getRuntime().availableProcessors()) + " cores");
|
||||
rows.add(row);
|
||||
|
||||
row = new ArrayList<>();
|
||||
row = new ArrayList<String>();
|
||||
row.add("Locale");
|
||||
row.add(Locale.getDefault().toString() + "/" + System.getProperty("file.encoding"));
|
||||
rows.add(row);
|
||||
|
||||
row = new ArrayList<>();
|
||||
row = new ArrayList<String>();
|
||||
row.add("Uptime");
|
||||
row.add(formatUptime(ManagementFactory.getRuntimeMXBean().getUptime()));
|
||||
rows.add(row);
|
||||
|
||||
row = new ArrayList<>();
|
||||
row = new ArrayList<String>();
|
||||
row.add("Time");
|
||||
row.add(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS Z").format(new Date()));
|
||||
rows.add(row);
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ public class RpcContext {
|
|||
final T o = callable.call();
|
||||
// local invoke will return directly
|
||||
if (o != null) {
|
||||
FutureTask<T> f = new FutureTask<>(new Callable<T>() {
|
||||
FutureTask<T> f = new FutureTask<T>(new Callable<T>() {
|
||||
@Override
|
||||
public T call() throws Exception {
|
||||
return o;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue