Compare commits
155 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
11d5bd9ffa | |
|
|
30bf8c4de8 | |
|
|
865e8b05cf | |
|
|
2dc0f9a374 | |
|
|
d98b1e821f | |
|
|
04c16fa944 | |
|
|
7d5fa50783 | |
|
|
99601a6198 | |
|
|
0a48e9d8dc | |
|
|
4be8594bde | |
|
|
9d333ba906 | |
|
|
c61cc9f719 | |
|
|
cd89d192b6 | |
|
|
8200f3ed2e | |
|
|
b76e0597f5 | |
|
|
87ab5a6964 | |
|
|
61effff7e8 | |
|
|
086cdd942c | |
|
|
dc2465fff7 | |
|
|
0ccd5a1953 | |
|
|
293711e591 | |
|
|
5ad25875b9 | |
|
|
b9825cdbd0 | |
|
|
79fa89bac7 | |
|
|
3e53e32053 | |
|
|
d7ac348f64 | |
|
|
14fd38f1b7 | |
|
|
d3eef04759 | |
|
|
a534350541 | |
|
|
48ad387ace | |
|
|
523a4189b8 | |
|
|
473ea36b04 | |
|
|
9fde4c9e60 | |
|
|
8fee3db28f | |
|
|
26113503e8 | |
|
|
a581afbb2c | |
|
|
913a9aac33 | |
|
|
0baba8646b | |
|
|
600f869ad7 | |
|
|
95f9984571 | |
|
|
d35d7eb30c | |
|
|
63e5bef4fa | |
|
|
6ad71e676c | |
|
|
da53578c57 | |
|
|
000db7c40a | |
|
|
2ddf0fdec4 | |
|
|
61bfa07a49 | |
|
|
d1969ff18b | |
|
|
1fd974efbf | |
|
|
c517fd5d62 | |
|
|
98edd118ae | |
|
|
89cc36e2b3 | |
|
|
e6f0dfe000 | |
|
|
3609ddb225 | |
|
|
bb376dbdd7 | |
|
|
65215ed8a0 | |
|
|
23599941e7 | |
|
|
a6c61175c5 | |
|
|
b12b23cbf0 | |
|
|
cc95b52dfb | |
|
|
189d76be5d | |
|
|
e21244a431 | |
|
|
57b87029a6 | |
|
|
75f0eb4a15 | |
|
|
b867f9ebd7 | |
|
|
d64fbf8b94 | |
|
|
a6187b8e93 | |
|
|
43ae6a7aba | |
|
|
faabbf6435 | |
|
|
9968834e62 | |
|
|
4cd9a98395 | |
|
|
80b145db3e | |
|
|
cd78bba7b7 | |
|
|
5d1c0eae1c | |
|
|
1e6a84e16a | |
|
|
8e2eb332a1 | |
|
|
5d916cd2c1 | |
|
|
84193247be | |
|
|
1abe9f8087 | |
|
|
dfd135eb95 | |
|
|
8863604619 | |
|
|
faefee2cb2 | |
|
|
9d659eba44 | |
|
|
7f6decaf19 | |
|
|
a3e43fe99b | |
|
|
c24eca7e1e | |
|
|
0fc6a30684 | |
|
|
66bea58c13 | |
|
|
14c67845ee | |
|
|
5db5fa9035 | |
|
|
35780baa39 | |
|
|
b2fb0e8e1e | |
|
|
53141b152f | |
|
|
1b69c61992 | |
|
|
0b7d980b51 | |
|
|
d16f0ca310 | |
|
|
20f252d147 | |
|
|
be7c863aed | |
|
|
e9296eca1d | |
|
|
7588d0e5b2 | |
|
|
efe219b770 | |
|
|
8e141cc958 | |
|
|
ac8a9b65b7 | |
|
|
0a1ad55bff | |
|
|
ca7151e531 | |
|
|
155c2f2c18 | |
|
|
6b3f54383f | |
|
|
aedf4d7192 | |
|
|
e825cb1117 | |
|
|
45b5d44064 | |
|
|
16bca1e42c | |
|
|
f987d50047 | |
|
|
3608f384c2 | |
|
|
029650668f | |
|
|
1689109725 | |
|
|
cf0529f7ae | |
|
|
3e4fda20bb | |
|
|
95439fb23c | |
|
|
f03823eec1 | |
|
|
40280a2c29 | |
|
|
b472712f05 | |
|
|
b44ca6b51f | |
|
|
ec443043e2 | |
|
|
00812ce41c | |
|
|
4be3587dd1 | |
|
|
1f74ffd969 | |
|
|
9e18589e81 | |
|
|
d7d46e635c | |
|
|
59b3c9c9dc | |
|
|
f4d75450b0 | |
|
|
fa07b61710 | |
|
|
1bdcc57860 | |
|
|
164aebf6ed | |
|
|
afcf04d6e3 | |
|
|
3f57fcae20 | |
|
|
898b774041 | |
|
|
df47d74a82 | |
|
|
ecc5db271e | |
|
|
2a6f534c41 | |
|
|
501f1a4f9b | |
|
|
a342f67dc0 | |
|
|
392260a30e | |
|
|
c92e7ca72b | |
|
|
4c598775e9 | |
|
|
86ffe7653d | |
|
|
7126d49cad | |
|
|
0553d70899 | |
|
|
b2c66a6d99 | |
|
|
6ca6f66fd4 | |
|
|
a1995ee8d2 | |
|
|
0cbefb1e33 | |
|
|
7edd760ecb | |
|
|
8d1a10f1ad | |
|
|
a4a0baccfd | |
|
|
501bdfaaef |
|
|
@ -55,3 +55,5 @@ github:
|
||||||
- http
|
- http
|
||||||
- grpc
|
- grpc
|
||||||
- web
|
- web
|
||||||
|
collaborators:
|
||||||
|
- oxsean
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ jobs:
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'zulu'
|
distribution: 'zulu'
|
||||||
java-version: 8
|
java-version: 21
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
name: "Cache local Maven repository"
|
name: "Cache local Maven repository"
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ target/
|
||||||
.settings/
|
.settings/
|
||||||
.project
|
.project
|
||||||
.classpath
|
.classpath
|
||||||
|
.externalToolBuilders
|
||||||
|
maven-eclipse.xml
|
||||||
|
|
||||||
# idea ignore
|
# idea ignore
|
||||||
.idea/
|
.idea/
|
||||||
|
|
@ -50,3 +52,6 @@ dubbo-demo/dubbo-demo-triple/build/*
|
||||||
|
|
||||||
.git.exec.error
|
.git.exec.error
|
||||||
|
|
||||||
|
# log files generated by testcase.
|
||||||
|
dubbo-rpc/dubbo-rpc-api/custom-access.log*
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ There's a [README](https://github.com/apache/dubbo-samples/blob/389cd612f1ea57ee
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<properties>
|
<properties>
|
||||||
<dubbo.version>3.2.11</dubbo.version>
|
<dubbo.version>3.2.13-SNAPSHOT</dubbo.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ public class SingleRouterChain<T> {
|
||||||
public RouterSnapshotNode<T> buildRouterSnapshot(
|
public RouterSnapshotNode<T> buildRouterSnapshot(
|
||||||
URL url, BitList<Invoker<T>> availableInvokers, Invocation invocation) {
|
URL url, BitList<Invoker<T>> availableInvokers, Invocation invocation) {
|
||||||
BitList<Invoker<T>> resultInvokers = availableInvokers.clone();
|
BitList<Invoker<T>> resultInvokers = availableInvokers.clone();
|
||||||
RouterSnapshotNode<T> parentNode = new RouterSnapshotNode<T>("Parent", resultInvokers.clone());
|
RouterSnapshotNode<T> parentNode = new RouterSnapshotNode<>("Parent", resultInvokers.clone());
|
||||||
parentNode.setNodeOutputInvokers(resultInvokers.clone());
|
parentNode.setNodeOutputInvokers(resultInvokers.clone());
|
||||||
|
|
||||||
// 1. route state router
|
// 1. route state router
|
||||||
|
|
@ -227,7 +227,7 @@ public class SingleRouterChain<T> {
|
||||||
return parentNode;
|
return parentNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RouterSnapshotNode<T> commonRouterNode = new RouterSnapshotNode<T>("CommonRouter", resultInvokers.clone());
|
RouterSnapshotNode<T> commonRouterNode = new RouterSnapshotNode<>("CommonRouter", resultInvokers.clone());
|
||||||
parentNode.appendNode(commonRouterNode);
|
parentNode.appendNode(commonRouterNode);
|
||||||
List<Invoker<T>> commonRouterResult = resultInvokers;
|
List<Invoker<T>> commonRouterResult = resultInvokers;
|
||||||
|
|
||||||
|
|
@ -237,7 +237,7 @@ public class SingleRouterChain<T> {
|
||||||
List<Invoker<T>> inputInvokers = new ArrayList<>(commonRouterResult);
|
List<Invoker<T>> inputInvokers = new ArrayList<>(commonRouterResult);
|
||||||
|
|
||||||
RouterSnapshotNode<T> currentNode =
|
RouterSnapshotNode<T> currentNode =
|
||||||
new RouterSnapshotNode<T>(router.getClass().getSimpleName(), inputInvokers);
|
new RouterSnapshotNode<>(router.getClass().getSimpleName(), inputInvokers);
|
||||||
|
|
||||||
// append to router node chain
|
// append to router node chain
|
||||||
commonRouterNode.appendNode(currentNode);
|
commonRouterNode.appendNode(currentNode);
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@ public abstract class AbstractConfigurator implements Configurator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<String> genConditionKeys() {
|
private Set<String> genConditionKeys() {
|
||||||
Set<String> conditionKeys = new HashSet<String>();
|
Set<String> conditionKeys = new HashSet<>();
|
||||||
conditionKeys.add(CATEGORY_KEY);
|
conditionKeys.add(CATEGORY_KEY);
|
||||||
conditionKeys.add(Constants.CHECK_KEY);
|
conditionKeys.add(Constants.CHECK_KEY);
|
||||||
conditionKeys.add(DYNAMIC_KEY);
|
conditionKeys.add(DYNAMIC_KEY);
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,7 @@ public class ConsistentHashLoadBalance extends AbstractLoadBalance {
|
||||||
*/
|
*/
|
||||||
public static final String HASH_ARGUMENTS = "hash.arguments";
|
public static final String HASH_ARGUMENTS = "hash.arguments";
|
||||||
|
|
||||||
private final ConcurrentMap<String, ConsistentHashSelector<?>> selectors =
|
private final ConcurrentMap<String, ConsistentHashSelector<?>> selectors = new ConcurrentHashMap<>();
|
||||||
new ConcurrentHashMap<String, ConsistentHashSelector<?>>();
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -75,7 +74,7 @@ public class ConsistentHashLoadBalance extends AbstractLoadBalance {
|
||||||
private final int[] argumentIndex;
|
private final int[] argumentIndex;
|
||||||
|
|
||||||
ConsistentHashSelector(List<Invoker<T>> invokers, String methodName, int identityHashCode) {
|
ConsistentHashSelector(List<Invoker<T>> invokers, String methodName, int identityHashCode) {
|
||||||
this.virtualInvokers = new TreeMap<Long, Invoker<T>>();
|
this.virtualInvokers = new TreeMap<>();
|
||||||
this.identityHashCode = identityHashCode;
|
this.identityHashCode = identityHashCode;
|
||||||
URL url = invokers.get(0).getUrl();
|
URL url = invokers.get(0).getUrl();
|
||||||
this.replicaNumber = url.getMethodParameter(methodName, HASH_NODES, 160);
|
this.replicaNumber = url.getMethodParameter(methodName, HASH_NODES, 160);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ public class MapMerger implements Merger<Map<?, ?>> {
|
||||||
if (ArrayUtils.isEmpty(items)) {
|
if (ArrayUtils.isEmpty(items)) {
|
||||||
return Collections.emptyMap();
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
Map<Object, Object> result = new HashMap<Object, Object>();
|
Map<Object, Object> result = new HashMap<>();
|
||||||
Stream.of(items).filter(Objects::nonNull).forEach(result::putAll);
|
Stream.of(items).filter(Objects::nonNull).forEach(result::putAll);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ public class MergerFactory implements ScopeModelAware {
|
||||||
|
|
||||||
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(MergerFactory.class);
|
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(MergerFactory.class);
|
||||||
|
|
||||||
private ConcurrentMap<Class<?>, Merger<?>> MERGER_CACHE = new ConcurrentHashMap<Class<?>, Merger<?>>();
|
private ConcurrentMap<Class<?>, Merger<?>> MERGER_CACHE = new ConcurrentHashMap<>();
|
||||||
private ScopeModel scopeModel;
|
private ScopeModel scopeModel;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ public class SetMerger implements Merger<Set<?>> {
|
||||||
if (ArrayUtils.isEmpty(items)) {
|
if (ArrayUtils.isEmpty(items)) {
|
||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
Set<Object> result = new HashSet<Object>();
|
Set<Object> result = new HashSet<>();
|
||||||
Stream.of(items).filter(Objects::nonNull).forEach(result::addAll);
|
Stream.of(items).filter(Objects::nonNull).forEach(result::addAll);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,6 @@ public class ConditionStateRouterFactory extends CacheableStateRouterFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T> StateRouter<T> createRouter(Class<T> interfaceClass, URL url) {
|
protected <T> StateRouter<T> createRouter(Class<T> interfaceClass, URL url) {
|
||||||
return new ConditionStateRouter<T>(url);
|
return new ConditionStateRouter<>(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,6 @@ public class ServiceStateRouterFactory extends CacheableStateRouterFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T> StateRouter<T> createRouter(Class<T> interfaceClass, URL url) {
|
protected <T> StateRouter<T> createRouter(Class<T> interfaceClass, URL url) {
|
||||||
return new ServiceStateRouter<T>(url);
|
return new ServiceStateRouter<>(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ public class MeshRuleCache<T> {
|
||||||
Collections.unmodifiableMap(totalSubsetMap),
|
Collections.unmodifiableMap(totalSubsetMap),
|
||||||
unmatchedInvokers);
|
unmatchedInvokers);
|
||||||
} else {
|
} else {
|
||||||
return new MeshRuleCache<T>(
|
return new MeshRuleCache<>(
|
||||||
Collections.emptyList(), Collections.emptyMap(), Collections.emptyMap(), invokers);
|
Collections.emptyList(), Collections.emptyMap(), Collections.emptyMap(), invokers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,6 @@ public class MockStateRouterFactory implements StateRouterFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> StateRouter<T> getRouter(Class<T> interfaceClass, URL url) {
|
public <T> StateRouter<T> getRouter(Class<T> interfaceClass, URL url) {
|
||||||
return new MockInvokersSelector<T>(url);
|
return new MockInvokersSelector<>(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,23 +93,23 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Provided by BitList only
|
// Provided by BitList only
|
||||||
public List<E> getOriginList() {
|
public synchronized List<E> getOriginList() {
|
||||||
return originList;
|
return originList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addIndex(int index) {
|
public synchronized void addIndex(int index) {
|
||||||
this.rootSet.set(index);
|
this.rootSet.set(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int totalSetSize() {
|
public synchronized int totalSetSize() {
|
||||||
return this.originList.size();
|
return this.originList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean indexExist(int index) {
|
public synchronized boolean indexExist(int index) {
|
||||||
return this.rootSet.get(index);
|
return this.rootSet.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public E getByIndex(int index) {
|
public synchronized E getByIndex(int index) {
|
||||||
return this.originList.get(index);
|
return this.originList.get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,7 +120,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
||||||
* @param target target bitList
|
* @param target target bitList
|
||||||
* @return this bitList only contains those elements contain in both two list and source bitList's tailList
|
* @return this bitList only contains those elements contain in both two list and source bitList's tailList
|
||||||
*/
|
*/
|
||||||
public BitList<E> and(BitList<E> target) {
|
public synchronized BitList<E> and(BitList<E> target) {
|
||||||
rootSet.and(target.rootSet);
|
rootSet.and(target.rootSet);
|
||||||
if (target.getTailList() != null) {
|
if (target.getTailList() != null) {
|
||||||
target.getTailList().forEach(this::addToTailList);
|
target.getTailList().forEach(this::addToTailList);
|
||||||
|
|
@ -128,28 +128,28 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BitList<E> or(BitList<E> target) {
|
public synchronized BitList<E> or(BitList<E> target) {
|
||||||
BitSet resultSet = (BitSet) rootSet.clone();
|
BitSet resultSet = (BitSet) rootSet.clone();
|
||||||
resultSet.or(target.rootSet);
|
resultSet.or(target.rootSet);
|
||||||
return new BitList<>(originList, resultSet, tailList);
|
return new BitList<>(originList, resultSet, tailList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasMoreElementInTailList() {
|
public synchronized boolean hasMoreElementInTailList() {
|
||||||
return CollectionUtils.isNotEmpty(tailList);
|
return CollectionUtils.isNotEmpty(tailList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<E> getTailList() {
|
public synchronized List<E> getTailList() {
|
||||||
return tailList;
|
return tailList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addToTailList(E e) {
|
public synchronized void addToTailList(E e) {
|
||||||
if (tailList == null) {
|
if (tailList == null) {
|
||||||
tailList = new LinkedList<>();
|
tailList = new LinkedList<>();
|
||||||
}
|
}
|
||||||
tailList.add(e);
|
tailList.add(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public E randomSelectOne() {
|
public synchronized E randomSelectOne() {
|
||||||
int originSize = originList.size();
|
int originSize = originList.size();
|
||||||
int tailSize = tailList != null ? tailList.size() : 0;
|
int tailSize = tailList != null ? tailList.size() : 0;
|
||||||
int totalSize = originSize + tailSize;
|
int totalSize = originSize + tailSize;
|
||||||
|
|
@ -181,18 +181,18 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
||||||
|
|
||||||
// Provided by JDK List interface
|
// Provided by JDK List interface
|
||||||
@Override
|
@Override
|
||||||
public int size() {
|
public synchronized int size() {
|
||||||
return rootSet.cardinality() + (CollectionUtils.isNotEmpty(tailList) ? tailList.size() : 0);
|
return rootSet.cardinality() + (CollectionUtils.isNotEmpty(tailList) ? tailList.size() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(Object o) {
|
public synchronized boolean contains(Object o) {
|
||||||
int idx = originList.indexOf(o);
|
int idx = originList.indexOf(o);
|
||||||
return (idx >= 0 && rootSet.get(idx)) || (CollectionUtils.isNotEmpty(tailList) && tailList.contains(o));
|
return (idx >= 0 && rootSet.get(idx)) || (CollectionUtils.isNotEmpty(tailList) && tailList.contains(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<E> iterator() {
|
public synchronized Iterator<E> iterator() {
|
||||||
return new BitListIterator<>(this, 0);
|
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.
|
* Notice: It is not recommended adding duplicated element.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean add(E e) {
|
public synchronized boolean add(E e) {
|
||||||
int index = originList.indexOf(e);
|
int index = originList.indexOf(e);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
rootSet.set(index);
|
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.
|
* If the element is not contained in originList, try to remove from tailList.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean remove(Object o) {
|
public synchronized boolean remove(Object o) {
|
||||||
int idx = originList.indexOf(o);
|
int idx = originList.indexOf(o);
|
||||||
if (idx > -1 && rootSet.get(idx)) {
|
if (idx > -1 && rootSet.get(idx)) {
|
||||||
rootSet.set(idx, false);
|
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.
|
* This may change the default behaviour when adding new element later.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void clear() {
|
public synchronized void clear() {
|
||||||
rootSet.clear();
|
rootSet.clear();
|
||||||
// to remove references
|
// to remove references
|
||||||
originList = Collections.emptyList();
|
originList = Collections.emptyList();
|
||||||
|
|
@ -252,7 +252,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E get(int index) {
|
public synchronized E get(int index) {
|
||||||
int bitIndex = -1;
|
int bitIndex = -1;
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
throw new IndexOutOfBoundsException();
|
throw new IndexOutOfBoundsException();
|
||||||
|
|
@ -272,7 +272,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E remove(int index) {
|
public synchronized E remove(int index) {
|
||||||
int bitIndex = -1;
|
int bitIndex = -1;
|
||||||
if (index >= rootSet.cardinality()) {
|
if (index >= rootSet.cardinality()) {
|
||||||
if (CollectionUtils.isNotEmpty(tailList)) {
|
if (CollectionUtils.isNotEmpty(tailList)) {
|
||||||
|
|
@ -290,7 +290,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int indexOf(Object o) {
|
public synchronized int indexOf(Object o) {
|
||||||
int bitIndex = -1;
|
int bitIndex = -1;
|
||||||
for (int i = 0; i < rootSet.cardinality(); i++) {
|
for (int i = 0; i < rootSet.cardinality(); i++) {
|
||||||
bitIndex = rootSet.nextSetBit(bitIndex + 1);
|
bitIndex = rootSet.nextSetBit(bitIndex + 1);
|
||||||
|
|
@ -311,7 +311,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public boolean addAll(Collection<? extends E> c) {
|
public synchronized boolean addAll(Collection<? extends E> c) {
|
||||||
if (c instanceof BitList) {
|
if (c instanceof BitList) {
|
||||||
rootSet.or(((BitList<? extends E>) c).rootSet);
|
rootSet.or(((BitList<? extends E>) c).rootSet);
|
||||||
if (((BitList<? extends E>) c).hasMoreElementInTailList()) {
|
if (((BitList<? extends E>) c).hasMoreElementInTailList()) {
|
||||||
|
|
@ -325,7 +325,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int lastIndexOf(Object o) {
|
public synchronized int lastIndexOf(Object o) {
|
||||||
int bitIndex = -1;
|
int bitIndex = -1;
|
||||||
int index = -1;
|
int index = -1;
|
||||||
if (CollectionUtils.isNotEmpty(tailList)) {
|
if (CollectionUtils.isNotEmpty(tailList)) {
|
||||||
|
|
@ -344,22 +344,22 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEmpty() {
|
public synchronized boolean isEmpty() {
|
||||||
return this.rootSet.isEmpty() && CollectionUtils.isEmpty(tailList);
|
return this.rootSet.isEmpty() && CollectionUtils.isEmpty(tailList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ListIterator<E> listIterator() {
|
public synchronized ListIterator<E> listIterator() {
|
||||||
return new BitListIterator<>(this, 0);
|
return new BitListIterator<>(this, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ListIterator<E> listIterator(int index) {
|
public synchronized ListIterator<E> listIterator(int index) {
|
||||||
return new BitListIterator<>(this, index);
|
return new BitListIterator<>(this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BitList<E> subList(int fromIndex, int toIndex) {
|
public synchronized BitList<E> subList(int fromIndex, int toIndex) {
|
||||||
BitSet resultSet = (BitSet) rootSet.clone();
|
BitSet resultSet = (BitSet) rootSet.clone();
|
||||||
List<E> copiedTailList = tailList == null ? null : new LinkedList<>(tailList);
|
List<E> copiedTailList = tailList == null ? null : new LinkedList<>(tailList);
|
||||||
if (toIndex < size()) {
|
if (toIndex < size()) {
|
||||||
|
|
@ -414,7 +414,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasNext() {
|
public synchronized boolean hasNext() {
|
||||||
if (isInTailList) {
|
if (isInTailList) {
|
||||||
return tailListIterator.hasNext();
|
return tailListIterator.hasNext();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -428,7 +428,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E next() {
|
public synchronized E next() {
|
||||||
if (isInTailList) {
|
if (isInTailList) {
|
||||||
if (tailListIterator.hasNext()) {
|
if (tailListIterator.hasNext()) {
|
||||||
index += 1;
|
index += 1;
|
||||||
|
|
@ -457,7 +457,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPrevious() {
|
public synchronized boolean hasPrevious() {
|
||||||
if (isInTailList) {
|
if (isInTailList) {
|
||||||
boolean hasPreviousInTailList = tailListIterator.hasPrevious();
|
boolean hasPreviousInTailList = tailListIterator.hasPrevious();
|
||||||
if (hasPreviousInTailList) {
|
if (hasPreviousInTailList) {
|
||||||
|
|
@ -471,7 +471,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public E previous() {
|
public synchronized E previous() {
|
||||||
if (isInTailList) {
|
if (isInTailList) {
|
||||||
boolean hasPreviousInTailList = tailListIterator.hasPrevious();
|
boolean hasPreviousInTailList = tailListIterator.hasPrevious();
|
||||||
if (hasPreviousInTailList) {
|
if (hasPreviousInTailList) {
|
||||||
|
|
@ -503,17 +503,17 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int nextIndex() {
|
public synchronized int nextIndex() {
|
||||||
return hasNext() ? index + 1 : index;
|
return hasNext() ? index + 1 : index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int previousIndex() {
|
public synchronized int previousIndex() {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove() {
|
public synchronized void remove() {
|
||||||
if (lastReturnedIndex == -1) {
|
if (lastReturnedIndex == -1) {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -533,17 +533,17 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void set(E e) {
|
public synchronized void set(E e) {
|
||||||
throw new UnsupportedOperationException("Set method is not supported in BitListIterator!");
|
throw new UnsupportedOperationException("Set method is not supported in BitListIterator!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(E e) {
|
public synchronized void add(E e) {
|
||||||
throw new UnsupportedOperationException("Add method is not supported in BitListIterator!");
|
throw new UnsupportedOperationException("Add method is not supported in BitListIterator!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<E> cloneToArrayList() {
|
public synchronized ArrayList<E> cloneToArrayList() {
|
||||||
if (rootSet.cardinality() == originList.size() && (CollectionUtils.isEmpty(tailList))) {
|
if (rootSet.cardinality() == originList.size() && (CollectionUtils.isEmpty(tailList))) {
|
||||||
return new ArrayList<>(originList);
|
return new ArrayList<>(originList);
|
||||||
}
|
}
|
||||||
|
|
@ -553,7 +553,7 @@ public class BitList<E> extends AbstractList<E> implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BitList<E> clone() {
|
public synchronized BitList<E> clone() {
|
||||||
return new BitList<>(
|
return new BitList<>(
|
||||||
originList, (BitSet) rootSet.clone(), tailList == null ? null : new LinkedList<>(tailList));
|
originList, (BitSet) rootSet.clone(), tailList == null ? null : new LinkedList<>(tailList));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,6 @@ public class TagStateRouterFactory extends CacheableStateRouterFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T> StateRouter<T> createRouter(Class<T> interfaceClass, URL url) {
|
protected <T> StateRouter<T> createRouter(Class<T> interfaceClass, URL url) {
|
||||||
return new TagStateRouter<T>(url);
|
return new TagStateRouter<>(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,8 @@ public class FailoverClusterInvoker<T> extends AbstractClusterInvoker<T> {
|
||||||
int len = calculateInvokeTimes(methodName);
|
int len = calculateInvokeTimes(methodName);
|
||||||
// retry loop.
|
// retry loop.
|
||||||
RpcException le = null; // last exception.
|
RpcException le = null; // last exception.
|
||||||
List<Invoker<T>> invoked = new ArrayList<Invoker<T>>(copyInvokers.size()); // invoked invokers.
|
List<Invoker<T>> invoked = new ArrayList<>(copyInvokers.size()); // invoked invokers.
|
||||||
Set<String> providers = new HashSet<String>(len);
|
Set<String> providers = new HashSet<>(len);
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
// Reselect before retry to avoid a change of candidate `invokers`.
|
// Reselect before retry to avoid a change of candidate `invokers`.
|
||||||
// NOTE: if `invokers` changed, then `invoked` also lose accuracy.
|
// NOTE: if `invokers` changed, then `invoked` also lose accuracy.
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,6 @@ public class MergeableCluster extends AbstractCluster {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> AbstractClusterInvoker<T> doJoin(Directory<T> directory) throws RpcException {
|
public <T> AbstractClusterInvoker<T> doJoin(Directory<T> directory) throws RpcException {
|
||||||
return new MergeableClusterInvoker<T>(directory);
|
return new MergeableClusterInvoker<>(directory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,6 @@ public class ZoneAwareCluster extends AbstractCluster {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T> AbstractClusterInvoker<T> doJoin(Directory<T> directory) throws RpcException {
|
protected <T> AbstractClusterInvoker<T> doJoin(Directory<T> directory) throws RpcException {
|
||||||
return new ZoneAwareClusterInvoker<T>(directory);
|
return new ZoneAwareClusterInvoker<>(directory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ public class MockClusterWrapper implements Cluster {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> Invoker<T> join(Directory<T> directory, boolean buildFilterChain) throws RpcException {
|
public <T> Invoker<T> join(Directory<T> directory, boolean buildFilterChain) throws RpcException {
|
||||||
return new MockClusterInvoker<T>(directory, this.cluster.join(directory, buildFilterChain));
|
return new MockClusterInvoker<>(directory, this.cluster.join(directory, buildFilterChain));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cluster getCluster() {
|
public Cluster getCluster() {
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
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.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
@ -576,4 +578,44 @@ class BitListTest {
|
||||||
set.add(new LinkedList<>(Arrays.asList("A", "B", "C", "D", "E", "F", "G")));
|
set.add(new LinkedList<>(Arrays.asList("A", "B", "C", "D", "E", "F", "G")));
|
||||||
Assertions.assertEquals(2, set.size());
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1295,6 +1295,19 @@ public /*final**/ class URL implements Serializable {
|
||||||
return serviceNameBuilder.toString();
|
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) {
|
private void append(StringBuilder target, String parameterName, boolean first) {
|
||||||
String parameterValue = this.getParameter(parameterName);
|
String parameterValue = this.getParameter(parameterName);
|
||||||
if (!isBlank(parameterValue)) {
|
if (!isBlank(parameterValue)) {
|
||||||
|
|
@ -1307,6 +1320,14 @@ 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}'
|
* The format of return value is '{group}/{interfaceName}:{version}'
|
||||||
*
|
*
|
||||||
|
|
@ -1376,6 +1397,10 @@ public /*final**/ class URL implements Serializable {
|
||||||
return buildString(true, false, true, true);
|
return buildString(true, false, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toServiceString(String... parameters) {
|
||||||
|
return buildString(true, true, true, true, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public String getServiceName() {
|
public String getServiceName() {
|
||||||
return getServiceInterface();
|
return getServiceInterface();
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.common;
|
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.ErrorTypeAwareLogger;
|
||||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||||
import org.apache.dubbo.common.utils.StringUtils;
|
import org.apache.dubbo.common.utils.StringUtils;
|
||||||
|
|
@ -60,7 +61,7 @@ public final class Version {
|
||||||
public static final int LOWEST_VERSION_FOR_RESPONSE_ATTACHMENT = 2000200; // 2.0.2
|
public static final int LOWEST_VERSION_FOR_RESPONSE_ATTACHMENT = 2000200; // 2.0.2
|
||||||
|
|
||||||
public static final int HIGHEST_PROTOCOL_VERSION = 2009900; // 2.0.99
|
public static final int HIGHEST_PROTOCOL_VERSION = 2009900; // 2.0.99
|
||||||
private static final Map<String, Integer> VERSION2INT = new HashMap<String, Integer>();
|
private static final Map<String, Integer> VERSION2INT = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// get dubbo version and last commit id
|
// get dubbo version and last commit id
|
||||||
|
|
@ -84,7 +85,8 @@ public final class Version {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void tryLoadVersionFromResource() throws IOException {
|
private static void tryLoadVersionFromResource() throws IOException {
|
||||||
Enumeration<URL> configLoader = Version.class.getClassLoader().getResources("META-INF/versions/dubbo-common");
|
Enumeration<URL> configLoader =
|
||||||
|
Version.class.getClassLoader().getResources(CommonConstants.DUBBO_VERSIONS_KEY + "/dubbo-common");
|
||||||
if (configLoader.hasMoreElements()) {
|
if (configLoader.hasMoreElements()) {
|
||||||
URL url = configLoader.nextElement();
|
URL url = configLoader.nextElement();
|
||||||
try (BufferedReader reader =
|
try (BufferedReader reader =
|
||||||
|
|
@ -312,7 +314,7 @@ public final class Version {
|
||||||
|
|
||||||
private static void checkArtifact(String artifactId) throws IOException {
|
private static void checkArtifact(String artifactId) throws IOException {
|
||||||
Enumeration<URL> artifactEnumeration =
|
Enumeration<URL> artifactEnumeration =
|
||||||
Version.class.getClassLoader().getResources("META-INF/versions/" + artifactId);
|
Version.class.getClassLoader().getResources(CommonConstants.DUBBO_VERSIONS_KEY + artifactId);
|
||||||
while (artifactEnumeration.hasMoreElements()) {
|
while (artifactEnumeration.hasMoreElements()) {
|
||||||
URL url = artifactEnumeration.nextElement();
|
URL url = artifactEnumeration.nextElement();
|
||||||
try (BufferedReader reader =
|
try (BufferedReader reader =
|
||||||
|
|
@ -348,7 +350,7 @@ public final class Version {
|
||||||
|
|
||||||
private static Set<String> loadArtifactIds() throws IOException {
|
private static Set<String> loadArtifactIds() throws IOException {
|
||||||
Enumeration<URL> artifactsEnumeration =
|
Enumeration<URL> artifactsEnumeration =
|
||||||
Version.class.getClassLoader().getResources("META-INF/versions/.artifacts");
|
Version.class.getClassLoader().getResources(CommonConstants.DUBBO_VERSIONS_KEY + "/.artifacts");
|
||||||
Set<String> artifactIds = new HashSet<>();
|
Set<String> artifactIds = new HashSet<>();
|
||||||
while (artifactsEnumeration.hasMoreElements()) {
|
while (artifactsEnumeration.hasMoreElements()) {
|
||||||
URL url = artifactsEnumeration.nextElement();
|
URL url = artifactsEnumeration.nextElement();
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,13 @@ import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||||
import org.apache.dubbo.common.resource.Disposable;
|
import org.apache.dubbo.common.resource.Disposable;
|
||||||
import org.apache.dubbo.common.utils.ConcurrentHashMapUtils;
|
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.common.utils.StringUtils;
|
||||||
import org.apache.dubbo.rpc.model.ScopeModelAccessor;
|
import org.apache.dubbo.rpc.model.ScopeModelAccessor;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
@ -53,7 +55,7 @@ public class ScopeBeanFactory {
|
||||||
private final List<BeanInfo> registeredBeanInfos = new CopyOnWriteArrayList<>();
|
private final List<BeanInfo> registeredBeanInfos = new CopyOnWriteArrayList<>();
|
||||||
private InstantiationStrategy instantiationStrategy;
|
private InstantiationStrategy instantiationStrategy;
|
||||||
private final AtomicBoolean destroyed = new AtomicBoolean();
|
private final AtomicBoolean destroyed = new AtomicBoolean();
|
||||||
private List<Class<?>> registeredClasses = new ArrayList<>();
|
private final Set<Class<?>> registeredClasses = new ConcurrentHashSet<>();
|
||||||
|
|
||||||
public ScopeBeanFactory(ScopeBeanFactory parent, ExtensionAccessor extensionAccessor) {
|
public ScopeBeanFactory(ScopeBeanFactory parent, ExtensionAccessor extensionAccessor) {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
|
@ -299,7 +301,7 @@ public class ScopeBeanFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Class<?>> getRegisteredClasses() {
|
public Set<Class<?>> getRegisteredClasses() {
|
||||||
return registeredClasses;
|
return registeredClasses;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ import java.util.Map;
|
||||||
public final class JavaBeanSerializeUtil {
|
public final class JavaBeanSerializeUtil {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(JavaBeanSerializeUtil.class);
|
private static final Logger logger = LoggerFactory.getLogger(JavaBeanSerializeUtil.class);
|
||||||
private static final Map<String, Class<?>> TYPES = new HashMap<String, Class<?>>();
|
private static final Map<String, Class<?>> TYPES = new HashMap<>();
|
||||||
private static final String ARRAY_PREFIX = "[";
|
private static final String ARRAY_PREFIX = "[";
|
||||||
private static final String REFERENCE_TYPE_PREFIX = "L";
|
private static final String REFERENCE_TYPE_PREFIX = "L";
|
||||||
private static final String REFERENCE_TYPE_SUFFIX = ";";
|
private static final String REFERENCE_TYPE_SUFFIX = ";";
|
||||||
|
|
@ -72,7 +72,7 @@ public final class JavaBeanSerializeUtil {
|
||||||
if (obj instanceof JavaBeanDescriptor) {
|
if (obj instanceof JavaBeanDescriptor) {
|
||||||
return (JavaBeanDescriptor) obj;
|
return (JavaBeanDescriptor) obj;
|
||||||
}
|
}
|
||||||
IdentityHashMap<Object, JavaBeanDescriptor> cache = new IdentityHashMap<Object, JavaBeanDescriptor>();
|
IdentityHashMap<Object, JavaBeanDescriptor> cache = new IdentityHashMap<>();
|
||||||
return createDescriptorIfAbsent(obj, accessor, cache);
|
return createDescriptorIfAbsent(obj, accessor, cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -209,7 +209,7 @@ public final class JavaBeanSerializeUtil {
|
||||||
if (beanDescriptor == null) {
|
if (beanDescriptor == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
IdentityHashMap<JavaBeanDescriptor, Object> cache = new IdentityHashMap<JavaBeanDescriptor, Object>();
|
IdentityHashMap<JavaBeanDescriptor, Object> cache = new IdentityHashMap<>();
|
||||||
Object result = instantiateForDeserialize(beanDescriptor, loader, cache);
|
Object result = instantiateForDeserialize(beanDescriptor, loader, cache);
|
||||||
deserializeInternal(result, beanDescriptor, loader, cache);
|
deserializeInternal(result, beanDescriptor, loader, cache);
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ public abstract class Mixin {
|
||||||
|
|
||||||
Class<?> neighbor = null;
|
Class<?> neighbor = null;
|
||||||
// impl methods.
|
// impl methods.
|
||||||
Set<String> worked = new HashSet<String>();
|
Set<String> worked = new HashSet<>();
|
||||||
for (int i = 0; i < ics.length; i++) {
|
for (int i = 0; i < ics.length; i++) {
|
||||||
if (!Modifier.isPublic(ics[i].getModifiers())) {
|
if (!Modifier.isPublic(ics[i].getModifiers())) {
|
||||||
String npkg = ics[i].getPackage().getName();
|
String npkg = ics[i].getPackage().getName();
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@ import javassist.CtMethod;
|
||||||
* Wrapper.
|
* Wrapper.
|
||||||
*/
|
*/
|
||||||
public abstract class Wrapper {
|
public abstract class Wrapper {
|
||||||
private static final ConcurrentMap<Class<?>, Wrapper> WRAPPER_MAP =
|
// class wrapper map
|
||||||
new ConcurrentHashMap<Class<?>, Wrapper>(); // class wrapper map
|
private static final ConcurrentMap<Class<?>, Wrapper> WRAPPER_MAP = new ConcurrentHashMap<>();
|
||||||
private static final String[] EMPTY_STRING_ARRAY = new String[0];
|
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 String[] OBJECT_METHODS = new String[] {"getClass", "hashCode", "toString", "equals"};
|
||||||
private static final Wrapper OBJECT_WRAPPER = new Wrapper() {
|
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) {
|
public static <K, V> Map<K, V> toMap(Map.Entry<K, V>[] entries) {
|
||||||
Map<K, V> map = new HashMap<K, V>();
|
Map<K, V> map = new HashMap<>();
|
||||||
if (entries != null && entries.length > 0) {
|
if (entries != null && entries.length > 0) {
|
||||||
for (Map.Entry<K, V> entry : entries) {
|
for (Map.Entry<K, V> entry : entries) {
|
||||||
map.put(entry.getKey(), entry.getValue());
|
map.put(entry.getKey(), entry.getValue());
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,9 @@ import java.io.StringReader;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
@ -43,6 +42,7 @@ import java.util.Set;
|
||||||
import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_SERVER_SHUTDOWN_TIMEOUT;
|
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_KEY;
|
||||||
import static org.apache.dubbo.common.constants.CommonConstants.SHUTDOWN_WAIT_SECONDS_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
|
* 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 ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(ConfigurationUtils.class);
|
||||||
private static final List<String> securityKey;
|
private static final Set<String> securityKey;
|
||||||
|
|
||||||
private static volatile long expectedShutdownTime = Long.MAX_VALUE;
|
private static volatile long expectedShutdownTime = Long.MAX_VALUE;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
List<String> keys = new LinkedList<>();
|
Set<String> keys = new HashSet<>();
|
||||||
keys.add("accesslog");
|
keys.add("accesslog");
|
||||||
keys.add("router");
|
keys.add("router");
|
||||||
keys.add("rule");
|
keys.add("rule");
|
||||||
keys.add("runtime");
|
keys.add("runtime");
|
||||||
keys.add("type");
|
keys.add("type");
|
||||||
securityKey = Collections.unmodifiableList(keys);
|
securityKey = Collections.unmodifiableSet(keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -213,11 +213,15 @@ public final class ConfigurationUtils {
|
||||||
properties.load(new StringReader(content));
|
properties.load(new StringReader(content));
|
||||||
properties.stringPropertyNames().forEach(k -> {
|
properties.stringPropertyNames().forEach(k -> {
|
||||||
boolean deny = false;
|
boolean deny = false;
|
||||||
for (String key : securityKey) {
|
// check whether property name is safe or not based on the last fragment kebab-case comparison.
|
||||||
if (k.contains(key)) {
|
String[] fragments = k.split("\\.");
|
||||||
deny = true;
|
if (securityKey.contains(StringUtils.convertToSplitName(fragments[fragments.length - 1], "-"))) {
|
||||||
break;
|
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));
|
||||||
}
|
}
|
||||||
if (!deny) {
|
if (!deny) {
|
||||||
map.put(k, properties.getProperty(k));
|
map.put(k, properties.getProperty(k));
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import java.util.concurrent.ExecutorService;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public interface CommonConstants {
|
public interface CommonConstants {
|
||||||
|
|
||||||
String DUBBO = "dubbo";
|
String DUBBO = "dubbo";
|
||||||
|
|
||||||
String TRIPLE = "tri";
|
String TRIPLE = "tri";
|
||||||
|
|
@ -267,12 +268,14 @@ public interface CommonConstants {
|
||||||
String $INVOKE = "$invoke";
|
String $INVOKE = "$invoke";
|
||||||
|
|
||||||
String $INVOKE_ASYNC = "$invokeAsync";
|
String $INVOKE_ASYNC = "$invokeAsync";
|
||||||
|
|
||||||
String GENERIC_PARAMETER_DESC = "Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;";
|
String GENERIC_PARAMETER_DESC = "Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* echo call
|
* echo call
|
||||||
*/
|
*/
|
||||||
String $ECHO = "$echo";
|
String $ECHO = "$echo";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* package version in the manifest
|
* package version in the manifest
|
||||||
*/
|
*/
|
||||||
|
|
@ -283,12 +286,19 @@ public interface CommonConstants {
|
||||||
int MAX_PROXY_COUNT = 65535;
|
int MAX_PROXY_COUNT = 65535;
|
||||||
|
|
||||||
String MONITOR_KEY = "monitor";
|
String MONITOR_KEY = "monitor";
|
||||||
|
|
||||||
String BACKGROUND_KEY = "background";
|
String BACKGROUND_KEY = "background";
|
||||||
|
|
||||||
String CLUSTER_KEY = "cluster";
|
String CLUSTER_KEY = "cluster";
|
||||||
|
|
||||||
String USERNAME_KEY = "username";
|
String USERNAME_KEY = "username";
|
||||||
|
|
||||||
String PASSWORD_KEY = "password";
|
String PASSWORD_KEY = "password";
|
||||||
|
|
||||||
String HOST_KEY = "host";
|
String HOST_KEY = "host";
|
||||||
|
|
||||||
String PORT_KEY = "port";
|
String PORT_KEY = "port";
|
||||||
|
|
||||||
String DUBBO_IP_TO_BIND = "DUBBO_IP_TO_BIND";
|
String DUBBO_IP_TO_BIND = "DUBBO_IP_TO_BIND";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -308,21 +318,29 @@ public interface CommonConstants {
|
||||||
String SHUTDOWN_WAIT_SECONDS_KEY = "dubbo.service.shutdown.wait.seconds";
|
String SHUTDOWN_WAIT_SECONDS_KEY = "dubbo.service.shutdown.wait.seconds";
|
||||||
|
|
||||||
String SHUTDOWN_WAIT_KEY = "dubbo.service.shutdown.wait";
|
String SHUTDOWN_WAIT_KEY = "dubbo.service.shutdown.wait";
|
||||||
|
|
||||||
String DUBBO_PROTOCOL = "dubbo";
|
String DUBBO_PROTOCOL = "dubbo";
|
||||||
|
|
||||||
String DUBBO_LABELS = "dubbo.labels";
|
String DUBBO_LABELS = "dubbo.labels";
|
||||||
|
|
||||||
String DUBBO_ENV_KEYS = "dubbo.env.keys";
|
String DUBBO_ENV_KEYS = "dubbo.env.keys";
|
||||||
|
|
||||||
String CONFIG_CONFIGFILE_KEY = "config-file";
|
String CONFIG_CONFIGFILE_KEY = "config-file";
|
||||||
|
|
||||||
String CONFIG_ENABLE_KEY = "highest-priority";
|
String CONFIG_ENABLE_KEY = "highest-priority";
|
||||||
|
|
||||||
String CONFIG_NAMESPACE_KEY = "namespace";
|
String CONFIG_NAMESPACE_KEY = "namespace";
|
||||||
|
|
||||||
String CHECK_KEY = "check";
|
String CHECK_KEY = "check";
|
||||||
|
|
||||||
String BACKLOG_KEY = "backlog";
|
String BACKLOG_KEY = "backlog";
|
||||||
|
|
||||||
String HEARTBEAT_EVENT = null;
|
String HEARTBEAT_EVENT = null;
|
||||||
|
|
||||||
String MOCK_HEARTBEAT_EVENT = "H";
|
String MOCK_HEARTBEAT_EVENT = "H";
|
||||||
|
|
||||||
String READONLY_EVENT = "R";
|
String READONLY_EVENT = "R";
|
||||||
|
|
||||||
String WRITEABLE_EVENT = "W";
|
String WRITEABLE_EVENT = "W";
|
||||||
|
|
||||||
String REFERENCE_FILTER_KEY = "reference.filter";
|
String REFERENCE_FILTER_KEY = "reference.filter";
|
||||||
|
|
@ -459,6 +477,7 @@ public interface CommonConstants {
|
||||||
String REGISTRY_DELAY_NOTIFICATION_KEY = "delay-notification";
|
String REGISTRY_DELAY_NOTIFICATION_KEY = "delay-notification";
|
||||||
|
|
||||||
String CACHE_CLEAR_TASK_INTERVAL = "dubbo.application.url.cache.task.interval";
|
String CACHE_CLEAR_TASK_INTERVAL = "dubbo.application.url.cache.task.interval";
|
||||||
|
|
||||||
String CACHE_CLEAR_WAITING_THRESHOLD = "dubbo.application.url.cache.clear.waiting";
|
String CACHE_CLEAR_WAITING_THRESHOLD = "dubbo.application.url.cache.clear.waiting";
|
||||||
|
|
||||||
String CLUSTER_INTERCEPTOR_COMPATIBLE_KEY = "dubbo.application.cluster.interceptor.compatible";
|
String CLUSTER_INTERCEPTOR_COMPATIBLE_KEY = "dubbo.application.cluster.interceptor.compatible";
|
||||||
|
|
@ -615,17 +634,18 @@ public interface CommonConstants {
|
||||||
String SERVICE_EXECUTOR = "service-executor";
|
String SERVICE_EXECUTOR = "service-executor";
|
||||||
|
|
||||||
String EXECUTOR_MANAGEMENT_MODE = "executor-management-mode";
|
String EXECUTOR_MANAGEMENT_MODE = "executor-management-mode";
|
||||||
|
|
||||||
String EXECUTOR_MANAGEMENT_MODE_DEFAULT = "default";
|
String EXECUTOR_MANAGEMENT_MODE_DEFAULT = "default";
|
||||||
|
|
||||||
String EXECUTOR_MANAGEMENT_MODE_ISOLATION = "isolation";
|
String EXECUTOR_MANAGEMENT_MODE_ISOLATION = "isolation";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* used in JVMUtil.java ,Control stack print lines, default is 32 lines
|
* used in JVMUtil.java ,Control stack print lines, default is 32 lines
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
String DUBBO_JSTACK_MAXLINE = "dubbo.jstack-dump.max-line";
|
String DUBBO_JSTACK_MAXLINE = "dubbo.jstack-dump.max-line";
|
||||||
|
|
||||||
String ENCODE_IN_IO_THREAD_KEY = "encode.in.io";
|
String ENCODE_IN_IO_THREAD_KEY = "encode.in.io";
|
||||||
|
|
||||||
boolean DEFAULT_ENCODE_IN_IO_THREAD = false;
|
boolean DEFAULT_ENCODE_IN_IO_THREAD = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -646,4 +666,8 @@ public interface CommonConstants {
|
||||||
String DUBBO_MANUAL_REGISTER_KEY = "dubbo.application.manual-register";
|
String DUBBO_MANUAL_REGISTER_KEY = "dubbo.application.manual-register";
|
||||||
|
|
||||||
String DUBBO2_COMPACT_ENABLE = "dubbo.compact.enable";
|
String DUBBO2_COMPACT_ENABLE = "dubbo.compact.enable";
|
||||||
|
|
||||||
|
String ZOOKEEPER_ENSEMBLE_TRACKER_KEY = "zookeeper.ensemble.tracker";
|
||||||
|
|
||||||
|
String DUBBO_VERSIONS_KEY = "META-INF/dubbo-versions";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -141,4 +141,11 @@ public interface RegistryConstants {
|
||||||
String ENABLE_EMPTY_PROTECTION_KEY = "enable-empty-protection";
|
String ENABLE_EMPTY_PROTECTION_KEY = "enable-empty-protection";
|
||||||
boolean DEFAULT_ENABLE_EMPTY_PROTECTION = false;
|
boolean DEFAULT_ENABLE_EMPTY_PROTECTION = false;
|
||||||
String REGISTER_CONSUMER_URL_KEY = "register-consumer-url";
|
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,6 +23,8 @@ import java.util.Map;
|
||||||
public interface JSON {
|
public interface JSON {
|
||||||
boolean isSupport();
|
boolean isSupport();
|
||||||
|
|
||||||
|
boolean isJson(String json);
|
||||||
|
|
||||||
<T> T toJavaObject(String json, Type type);
|
<T> T toJavaObject(String json, Type type);
|
||||||
|
|
||||||
<T> List<T> toJavaList(String json, Class<T> clazz);
|
<T> List<T> toJavaList(String json, Class<T> clazz);
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,17 @@ package org.apache.dubbo.common.json.impl;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONValidator;
|
||||||
import com.alibaba.fastjson2.JSONWriter;
|
import com.alibaba.fastjson2.JSONWriter;
|
||||||
|
|
||||||
public class FastJson2Impl extends AbstractJSONImpl {
|
public class FastJson2Impl extends AbstractJSONImpl {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isJson(String json) {
|
||||||
|
JSONValidator validator = JSONValidator.from(json);
|
||||||
|
return validator.validate();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> T toJavaObject(String json, Type type) {
|
public <T> T toJavaObject(String json, Type type) {
|
||||||
return com.alibaba.fastjson2.JSON.parseObject(json, type);
|
return com.alibaba.fastjson2.JSON.parseObject(json, type);
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,16 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||||
|
|
||||||
public class FastJsonImpl extends AbstractJSONImpl {
|
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
|
@Override
|
||||||
public <T> T toJavaObject(String json, Type type) {
|
public <T> T toJavaObject(String json, Type type) {
|
||||||
return com.alibaba.fastjson.JSON.parseObject(json, type);
|
return com.alibaba.fastjson.JSON.parseObject(json, type);
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,25 @@ import java.lang.reflect.Type;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
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;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
public class GsonImpl extends AbstractJSONImpl {
|
public class GsonImpl extends AbstractJSONImpl {
|
||||||
// weak reference of com.google.gson.Gson, prevent throw exception when init
|
// weak reference of com.google.gson.Gson, prevent throw exception when init
|
||||||
private volatile Object gsonCache = null;
|
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
|
@Override
|
||||||
public <T> T toJavaObject(String json, Type type) {
|
public <T> T toJavaObject(String json, Type type) {
|
||||||
return getGson().fromJson(json, type);
|
return getGson().fromJson(json, type);
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,9 @@ import java.lang.reflect.Type;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.MapperFeature;
|
import com.fasterxml.jackson.databind.MapperFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.json.JsonMapper;
|
import com.fasterxml.jackson.databind.json.JsonMapper;
|
||||||
|
|
@ -31,6 +33,16 @@ public class JacksonImpl extends AbstractJSONImpl {
|
||||||
|
|
||||||
private volatile Object jacksonCache = null;
|
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
|
@Override
|
||||||
public <T> T toJavaObject(String json, Type type) {
|
public <T> T toJavaObject(String json, Type type) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -34,4 +34,6 @@ public interface DataStore {
|
||||||
void put(String componentName, String key, Object value);
|
void put(String componentName, String key, Object value);
|
||||||
|
|
||||||
void remove(String componentName, String key);
|
void remove(String componentName, String key);
|
||||||
|
|
||||||
|
default void addListener(DataStoreUpdateListener dataStoreUpdateListener) {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* 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,8 +16,13 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.common.store.support;
|
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.DataStore;
|
||||||
|
import org.apache.dubbo.common.store.DataStoreUpdateListener;
|
||||||
import org.apache.dubbo.common.utils.ConcurrentHashMapUtils;
|
import org.apache.dubbo.common.utils.ConcurrentHashMapUtils;
|
||||||
|
import org.apache.dubbo.common.utils.ConcurrentHashSet;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -25,9 +30,11 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
public class SimpleDataStore implements DataStore {
|
public class SimpleDataStore implements DataStore {
|
||||||
|
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(SimpleDataStore.class);
|
||||||
|
|
||||||
// <component name or id, <data-name, data-value>>
|
// <component name or id, <data-name, data-value>>
|
||||||
private final ConcurrentMap<String, ConcurrentMap<String, Object>> data = new ConcurrentHashMap<>();
|
private final ConcurrentMap<String, ConcurrentMap<String, Object>> data = new ConcurrentHashMap<>();
|
||||||
|
private final ConcurrentHashSet<DataStoreUpdateListener> listeners = new ConcurrentHashSet<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> get(String componentName) {
|
public Map<String, Object> get(String componentName) {
|
||||||
|
|
@ -52,6 +59,7 @@ public class SimpleDataStore implements DataStore {
|
||||||
Map<String, Object> componentData =
|
Map<String, Object> componentData =
|
||||||
ConcurrentHashMapUtils.computeIfAbsent(data, componentName, k -> new ConcurrentHashMap<>());
|
ConcurrentHashMapUtils.computeIfAbsent(data, componentName, k -> new ConcurrentHashMap<>());
|
||||||
componentData.put(key, value);
|
componentData.put(key, value);
|
||||||
|
notifyListeners(componentName, key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -60,5 +68,27 @@ public class SimpleDataStore implements DataStore {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
data.get(componentName).remove(key);
|
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 Object[] indexedVariables;
|
||||||
|
|
||||||
private static ThreadLocal<InternalThreadLocalMap> slowThreadLocalMap = new ThreadLocal<InternalThreadLocalMap>();
|
private static ThreadLocal<InternalThreadLocalMap> slowThreadLocalMap = new ThreadLocal<>();
|
||||||
|
|
||||||
private static final AtomicInteger NEXT_INDEX = new AtomicInteger();
|
private static final AtomicInteger NEXT_INDEX = new AtomicInteger();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -427,7 +427,7 @@ public class HashedWheelTimer implements Timer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class Worker implements Runnable {
|
private final class Worker implements Runnable {
|
||||||
private final Set<Timeout> unprocessedTimeouts = new HashSet<Timeout>();
|
private final Set<Timeout> unprocessedTimeouts = new HashSet<>();
|
||||||
|
|
||||||
private long tick;
|
private long tick;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ public class CIDRUtils {
|
||||||
|
|
||||||
private byte[] toBytes(byte[] array, int targetSize) {
|
private byte[] toBytes(byte[] array, int targetSize) {
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
List<Byte> newArr = new ArrayList<Byte>();
|
List<Byte> newArr = new ArrayList<>();
|
||||||
while (counter < targetSize && (array.length - 1 - counter >= 0)) {
|
while (counter < targetSize && (array.length - 1 - counter >= 0)) {
|
||||||
newArr.add(0, array[array.length - 1 - counter]);
|
newArr.add(0, array[array.length - 1 - counter]);
|
||||||
counter++;
|
counter++;
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ public class ConfigUtils {
|
||||||
*/
|
*/
|
||||||
public static List<String> mergeValues(
|
public static List<String> mergeValues(
|
||||||
ExtensionDirector extensionDirector, Class<?> type, String cfg, List<String> def) {
|
ExtensionDirector extensionDirector, Class<?> type, String cfg, List<String> def) {
|
||||||
List<String> defaults = new ArrayList<String>();
|
List<String> defaults = new ArrayList<>();
|
||||||
if (def != null) {
|
if (def != null) {
|
||||||
for (String name : def) {
|
for (String name : def) {
|
||||||
if (extensionDirector.getExtensionLoader(type).hasExtension(name)) {
|
if (extensionDirector.getExtensionLoader(type).hasExtension(name)) {
|
||||||
|
|
@ -96,7 +96,7 @@ public class ConfigUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> names = new ArrayList<String>();
|
List<String> names = new ArrayList<>();
|
||||||
|
|
||||||
// add initial values
|
// add initial values
|
||||||
String[] configs = (cfg == null || cfg.trim().length() == 0) ? new String[0] : COMMA_SPLIT_PATTERN.split(cfg);
|
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
|
* @throws IOException If an I/O error occurs
|
||||||
*/
|
*/
|
||||||
public static String[] readLines(InputStream is) throws IOException {
|
public static String[] readLines(InputStream is) throws IOException {
|
||||||
List<String> lines = new ArrayList<String>();
|
List<String> lines = new ArrayList<>();
|
||||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
|
try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
|
||||||
String line;
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
|
|
|
||||||
|
|
@ -146,4 +146,8 @@ public class JsonUtils {
|
||||||
public static List<String> checkStringList(List<?> rawList) {
|
public static List<String> checkStringList(List<?> rawList) {
|
||||||
return getJson().checkStringList(rawList);
|
return getJson().checkStringList(rawList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean checkJson(String json) {
|
||||||
|
return getJson().isJson(json);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import java.util.List;
|
||||||
public class Stack<E> {
|
public class Stack<E> {
|
||||||
private int mSize = 0;
|
private int mSize = 0;
|
||||||
|
|
||||||
private final List<E> mElements = new ArrayList<E>();
|
private final List<E> mElements = new ArrayList<>();
|
||||||
|
|
||||||
public Stack() {}
|
public Stack() {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -861,7 +861,7 @@ public final class StringUtils {
|
||||||
*/
|
*/
|
||||||
private static Map<String, String> parseKeyValuePair(String str, String itemSeparator) {
|
private static Map<String, String> parseKeyValuePair(String str, String itemSeparator) {
|
||||||
String[] tmp = str.split(itemSeparator);
|
String[] tmp = str.split(itemSeparator);
|
||||||
Map<String, String> map = new HashMap<String, String>(tmp.length);
|
Map<String, String> map = new HashMap<>(tmp.length);
|
||||||
for (int i = 0; i < tmp.length; i++) {
|
for (int i = 0; i < tmp.length; i++) {
|
||||||
Matcher matcher = KVP_PATTERN.matcher(tmp[i]);
|
Matcher matcher = KVP_PATTERN.matcher(tmp[i]);
|
||||||
if (!matcher.matches()) {
|
if (!matcher.matches()) {
|
||||||
|
|
@ -885,7 +885,7 @@ public final class StringUtils {
|
||||||
*/
|
*/
|
||||||
public static Map<String, String> parseQueryString(String qs) {
|
public static Map<String, String> parseQueryString(String qs) {
|
||||||
if (isEmpty(qs)) {
|
if (isEmpty(qs)) {
|
||||||
return new HashMap<String, String>();
|
return new HashMap<>();
|
||||||
}
|
}
|
||||||
return parseKeyValuePair(qs, "\\&");
|
return parseKeyValuePair(qs, "\\&");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ public class UrlUtils {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Addresses is not allowed to be empty, please re-enter."); // here won't be empty
|
"Addresses is not allowed to be empty, please re-enter."); // here won't be empty
|
||||||
}
|
}
|
||||||
List<URL> registries = new ArrayList<URL>();
|
List<URL> registries = new ArrayList<>();
|
||||||
for (String addr : addresses) {
|
for (String addr : addresses) {
|
||||||
registries.add(parseURL(addr, defaults));
|
registries.add(parseURL(addr, defaults));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ public abstract class AbstractInterfaceConfig extends AbstractMethodConfig {
|
||||||
/**
|
/**
|
||||||
* The url of the reference service
|
* The url of the reference service
|
||||||
*/
|
*/
|
||||||
protected final transient List<URL> urls = new ArrayList<URL>();
|
protected final transient List<URL> urls = new ArrayList<>();
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
public List<URL> getExportedUrls() {
|
public List<URL> getExportedUrls() {
|
||||||
|
|
|
||||||
|
|
@ -361,7 +361,7 @@ public class ApplicationConfig extends AbstractConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegistry(RegistryConfig registry) {
|
public void setRegistry(RegistryConfig registry) {
|
||||||
List<RegistryConfig> registries = new ArrayList<RegistryConfig>(1);
|
List<RegistryConfig> registries = new ArrayList<>(1);
|
||||||
registries.add(registry);
|
registries.add(registry);
|
||||||
this.registries = registries;
|
this.registries = registries;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,11 @@ public interface Constants {
|
||||||
|
|
||||||
String SERVER_THREAD_POOL_NAME = "DubboServerHandler";
|
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_NAME = "DubboClientHandler";
|
||||||
|
|
||||||
|
String CLIENT_THREAD_POOL_PREFIX = CLIENT_THREAD_POOL_NAME + "-";
|
||||||
|
|
||||||
String REST_PROTOCOL = "rest";
|
String REST_PROTOCOL = "rest";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ public class ModuleConfig extends AbstractConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegistry(RegistryConfig registry) {
|
public void setRegistry(RegistryConfig registry) {
|
||||||
List<RegistryConfig> registries = new ArrayList<RegistryConfig>(1);
|
List<RegistryConfig> registries = new ArrayList<>(1);
|
||||||
registries.add(registry);
|
registries.add(registry);
|
||||||
this.registries = registries;
|
this.registries = registries;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ 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.CommonConstants.SHUTDOWN_WAIT_KEY;
|
||||||
import static org.apache.dubbo.common.constants.RegistryConstants.ENABLE_EMPTY_PROTECTION_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.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.constants.RemotingConstants.BACKUP_KEY;
|
||||||
import static org.apache.dubbo.common.utils.PojoUtils.updatePropertyIfAbsent;
|
import static org.apache.dubbo.common.utils.PojoUtils.updatePropertyIfAbsent;
|
||||||
|
|
||||||
|
|
@ -221,7 +220,6 @@ public class RegistryConfig extends AbstractConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Parameter(key = REGISTRY_CLUSTER_KEY)
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return super.getId();
|
return super.getId();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ public final class ClassUtils {
|
||||||
* @return methods list
|
* @return methods list
|
||||||
*/
|
*/
|
||||||
public static List<Method> getPublicNonStaticMethods(final Class<?> clazz) {
|
public static List<Method> getPublicNonStaticMethods(final Class<?> clazz) {
|
||||||
List<Method> result = new ArrayList<Method>();
|
List<Method> result = new ArrayList<>();
|
||||||
|
|
||||||
Method[] methods = clazz.getMethods();
|
Method[] methods = clazz.getMethods();
|
||||||
for (Method method : methods) {
|
for (Method method : methods) {
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ public class ProviderModel extends ServiceModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ProviderMethodModel> getAllMethodModels() {
|
public List<ProviderMethodModel> getAllMethodModels() {
|
||||||
List<ProviderMethodModel> result = new ArrayList<ProviderMethodModel>();
|
List<ProviderMethodModel> result = new ArrayList<>();
|
||||||
for (List<ProviderMethodModel> models : methods.values()) {
|
for (List<ProviderMethodModel> models : methods.values()) {
|
||||||
result.addAll(models);
|
result.addAll(models);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,6 @@ org.thymeleaf.
|
||||||
org.yaml.snakeyaml.tokens.
|
org.yaml.snakeyaml.tokens.
|
||||||
pstore.shaded.org.apache.commons.collections.
|
pstore.shaded.org.apache.commons.collections.
|
||||||
sun.print.
|
sun.print.
|
||||||
sun.rmi.server.
|
sun.rmi.
|
||||||
sun.rmi.transport.
|
|
||||||
weblogic.ejb20.internal.
|
weblogic.ejb20.internal.
|
||||||
weblogic.jms.common.
|
weblogic.jms.common.
|
||||||
|
|
|
||||||
|
|
@ -1132,4 +1132,22 @@ class URLTest {
|
||||||
assertEquals(20881, url.getPort());
|
assertEquals(20881, url.getPort());
|
||||||
assertEquals("apache", url.getParameter("name"));
|
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,6 +22,7 @@ import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import javassist.ClassPool;
|
import javassist.ClassPool;
|
||||||
|
|
||||||
|
|
@ -56,7 +57,8 @@ class ClassGeneratorTest {
|
||||||
ClassGenerator cg = ClassGenerator.newInstance();
|
ClassGenerator cg = ClassGenerator.newInstance();
|
||||||
|
|
||||||
// add className, interface, superClass
|
// add className, interface, superClass
|
||||||
String className = BaseClass.class.getPackage().getName() + ".TestClass";
|
String className = BaseClass.class.getPackage().getName() + ".TestClass"
|
||||||
|
+ UUID.randomUUID().toString().replace("-", "");
|
||||||
cg.setClassName(className);
|
cg.setClassName(className);
|
||||||
cg.addInterface(BaseInterface.class);
|
cg.addInterface(BaseInterface.class);
|
||||||
cg.setSuperClass(BaseClass.class);
|
cg.setSuperClass(BaseClass.class);
|
||||||
|
|
@ -184,7 +186,7 @@ class ClassGeneratorTest {
|
||||||
fname.setAccessible(true);
|
fname.setAccessible(true);
|
||||||
|
|
||||||
ClassGenerator cg = ClassGenerator.newInstance();
|
ClassGenerator cg = ClassGenerator.newInstance();
|
||||||
cg.setClassName(Bean.class.getName() + "$Builder");
|
cg.setClassName(Bean.class.getName() + "$Builder" + UUID.randomUUID().toString());
|
||||||
cg.addInterface(Builder.class);
|
cg.addInterface(Builder.class);
|
||||||
|
|
||||||
cg.addField("public static java.lang.reflect.Field FNAME;");
|
cg.addField("public static java.lang.reflect.Field FNAME;");
|
||||||
|
|
@ -211,7 +213,7 @@ class ClassGeneratorTest {
|
||||||
fname.setAccessible(true);
|
fname.setAccessible(true);
|
||||||
|
|
||||||
ClassGenerator cg = ClassGenerator.newInstance();
|
ClassGenerator cg = ClassGenerator.newInstance();
|
||||||
cg.setClassName(Bean.class.getName() + "$Builder2");
|
cg.setClassName(Bean.class.getName() + "$Builder2" + UUID.randomUUID().toString());
|
||||||
cg.addInterface(Builder.class);
|
cg.addInterface(Builder.class);
|
||||||
|
|
||||||
cg.addField("FNAME", Modifier.PUBLIC | Modifier.STATIC, java.lang.reflect.Field.class);
|
cg.addField("FNAME", Modifier.PUBLIC | Modifier.STATIC, java.lang.reflect.Field.class);
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,7 @@ class ExtensionDirectorTest {
|
||||||
// 2. Child ExtensionDirector can get extension instance from parent
|
// 2. Child ExtensionDirector can get extension instance from parent
|
||||||
// 3. Parent ExtensionDirector can't get extension instance from child
|
// 3. Parent ExtensionDirector can't get extension instance from child
|
||||||
|
|
||||||
ExtensionDirector fwExtensionDirector =
|
ExtensionDirector fwExtensionDirector = FrameworkModel.defaultModel().getExtensionDirector();
|
||||||
new ExtensionDirector(null, ExtensionScope.FRAMEWORK, FrameworkModel.defaultModel());
|
|
||||||
ExtensionDirector appExtensionDirector =
|
ExtensionDirector appExtensionDirector =
|
||||||
new ExtensionDirector(fwExtensionDirector, ExtensionScope.APPLICATION, ApplicationModel.defaultModel());
|
new ExtensionDirector(fwExtensionDirector, ExtensionScope.APPLICATION, ApplicationModel.defaultModel());
|
||||||
ExtensionDirector moduleExtensionDirector = new ExtensionDirector(
|
ExtensionDirector moduleExtensionDirector = new ExtensionDirector(
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,8 @@ class GsonUtilsTest {
|
||||||
Assertions.fail();
|
Assertions.fail();
|
||||||
} catch (RuntimeException ex) {
|
} catch (RuntimeException ex) {
|
||||||
Assertions.assertEquals(
|
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",
|
"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",
|
||||||
ex.getMessage());
|
ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,13 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.common.store.support;
|
package org.apache.dubbo.common.store.support;
|
||||||
|
|
||||||
|
import org.apache.dubbo.common.store.DataStoreUpdateListener;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
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.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
|
|
@ -57,4 +61,30 @@ class SimpleDataStoreTest {
|
||||||
dataStore.remove("component", "key");
|
dataStore.remove("component", "key");
|
||||||
assertNotEquals(map, dataStore.get("component"));
|
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,6 +63,49 @@ 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
|
@Test
|
||||||
void testGetJson1() {
|
void testGetJson1() {
|
||||||
Assertions.assertNotNull(JsonUtils.getJson());
|
Assertions.assertNotNull(JsonUtils.getJson());
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
package org.apache.dubbo.common.version;
|
package org.apache.dubbo.common.version;
|
||||||
|
|
||||||
import 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.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -110,7 +111,7 @@ class VersionTest {
|
||||||
ClassLoader classLoader = new ClassLoader(originClassLoader) {
|
ClassLoader classLoader = new ClassLoader(originClassLoader) {
|
||||||
@Override
|
@Override
|
||||||
public Class<?> loadClass(String name) throws ClassNotFoundException {
|
public Class<?> loadClass(String name) throws ClassNotFoundException {
|
||||||
if (name.equals("org.apache.dubbo.common.Version")) {
|
if ("org.apache.dubbo.common.Version".equals(name)) {
|
||||||
return findClass(name);
|
return findClass(name);
|
||||||
}
|
}
|
||||||
return super.loadClass(name);
|
return super.loadClass(name);
|
||||||
|
|
@ -145,15 +146,13 @@ class VersionTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enumeration<URL> getResources(String name) throws IOException {
|
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("META-INF/test-versions/dubbo-common");
|
||||||
}
|
}
|
||||||
return super.getResources(name);
|
return super.getResources(name);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Class<?> versionClass = classLoader.loadClass("org.apache.dubbo.common.Version");
|
return classLoader.loadClass("org.apache.dubbo.common.Version");
|
||||||
return versionClass;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.METHOD_KEY;
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public abstract class AbstractCacheFactory implements CacheFactory {
|
public abstract class AbstractCacheFactory implements CacheFactory {
|
||||||
|
|
||||||
private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<String, Cache>();
|
private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Cache getCache(URL url, Invocation invocation) {
|
public Cache getCache(URL url, Invocation invocation) {
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ public class ServiceConfig<T> extends org.apache.dubbo.config.ServiceConfig<T> {
|
||||||
if (providers == null || providers.isEmpty()) {
|
if (providers == null || providers.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<ProtocolConfig> protocols = new ArrayList<ProtocolConfig>(providers.size());
|
List<ProtocolConfig> protocols = new ArrayList<>(providers.size());
|
||||||
for (ProviderConfig provider : providers) {
|
for (ProviderConfig provider : providers) {
|
||||||
protocols.add(convertProviderToProtocol(provider));
|
protocols.add(convertProviderToProtocol(provider));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,8 @@ public class Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<List<String>> stringToList(String str) {
|
private static List<List<String>> stringToList(String str) {
|
||||||
List<List<String>> rows = new ArrayList<List<String>>();
|
List<List<String>> rows = new ArrayList<>();
|
||||||
List<String> row = new ArrayList<String>();
|
List<String> row = new ArrayList<>();
|
||||||
row.add(str);
|
row.add(str);
|
||||||
rows.add(row);
|
rows.add(row);
|
||||||
return rows;
|
return rows;
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,8 @@ public class PageServlet extends HttpServlet {
|
||||||
private static final long serialVersionUID = -8370312705453328501L;
|
private static final long serialVersionUID = -8370312705453328501L;
|
||||||
private static PageServlet INSTANCE;
|
private static PageServlet INSTANCE;
|
||||||
protected final Random random = new Random();
|
protected final Random random = new Random();
|
||||||
protected final Map<String, PageHandler> pages = new ConcurrentHashMap<String, PageHandler>();
|
protected final Map<String, PageHandler> pages = new ConcurrentHashMap<>();
|
||||||
protected final List<PageHandler> menus = new ArrayList<PageHandler>();
|
protected final List<PageHandler> menus = new ArrayList<>();
|
||||||
|
|
||||||
public static PageServlet getInstance() {
|
public static PageServlet getInstance() {
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ public class ResourceFilter implements Filter {
|
||||||
|
|
||||||
private final long start = System.currentTimeMillis();
|
private final long start = System.currentTimeMillis();
|
||||||
|
|
||||||
private final List<String> resources = new ArrayList<String>();
|
private final List<String> resources = new ArrayList<>();
|
||||||
|
|
||||||
public void init(FilterConfig filterConfig) throws ServletException {
|
public void init(FilterConfig filterConfig) throws ServletException {
|
||||||
String config = filterConfig.getInitParameter("resources");
|
String config = filterConfig.getInitParameter("resources");
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,11 @@ public class HomePageHandler implements PageHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page handle(URL url) {
|
public Page handle(URL url) {
|
||||||
List<List<String>> rows = new ArrayList<List<String>>();
|
List<List<String>> rows = new ArrayList<>();
|
||||||
for (PageHandler handler : PageServlet.getInstance().getMenus()) {
|
for (PageHandler handler : PageServlet.getInstance().getMenus()) {
|
||||||
String uri = ExtensionLoader.getExtensionLoader(PageHandler.class).getExtensionName(handler);
|
String uri = ExtensionLoader.getExtensionLoader(PageHandler.class).getExtensionName(handler);
|
||||||
Menu menu = handler.getClass().getAnnotation(Menu.class);
|
Menu menu = handler.getClass().getAnnotation(Menu.class);
|
||||||
List<String> row = new ArrayList<String>();
|
List<String> row = new ArrayList<>();
|
||||||
row.add("<a href=\"" + uri + ".html\">" + menu.name() + "</a>");
|
row.add("<a href=\"" + uri + ".html\">" + menu.name() + "</a>");
|
||||||
row.add(menu.desc());
|
row.add(menu.desc());
|
||||||
rows.add(row);
|
rows.add(row);
|
||||||
|
|
|
||||||
|
|
@ -97,8 +97,8 @@ public class LogPageHandler implements PageHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Level level = LogManager.getRootLogger().getLevel();
|
Level level = LogManager.getRootLogger().getLevel();
|
||||||
List<List<String>> rows = new ArrayList<List<String>>();
|
List<List<String>> rows = new ArrayList<>();
|
||||||
List<String> row = new ArrayList<String>();
|
List<String> row = new ArrayList<>();
|
||||||
row.add(content);
|
row.add(content);
|
||||||
rows.add(row);
|
rows.add(row);
|
||||||
return new Page(
|
return new Page(
|
||||||
|
|
|
||||||
|
|
@ -40,14 +40,14 @@ public class StatusPageHandler implements PageHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page handle(URL url) {
|
public Page handle(URL url) {
|
||||||
List<List<String>> rows = new ArrayList<List<String>>();
|
List<List<String>> rows = new ArrayList<>();
|
||||||
Set<String> names =
|
Set<String> names =
|
||||||
ExtensionLoader.getExtensionLoader(StatusChecker.class).getSupportedExtensions();
|
ExtensionLoader.getExtensionLoader(StatusChecker.class).getSupportedExtensions();
|
||||||
Map<String, Status> statuses = new HashMap<String, Status>();
|
Map<String, Status> statuses = new HashMap<>();
|
||||||
for (String name : names) {
|
for (String name : names) {
|
||||||
StatusChecker checker =
|
StatusChecker checker =
|
||||||
ExtensionLoader.getExtensionLoader(StatusChecker.class).getExtension(name);
|
ExtensionLoader.getExtensionLoader(StatusChecker.class).getExtension(name);
|
||||||
List<String> row = new ArrayList<String>();
|
List<String> row = new ArrayList<>();
|
||||||
row.add(name);
|
row.add(name);
|
||||||
Status status = checker.check();
|
Status status = checker.check();
|
||||||
if (status != null && !Status.Level.UNKNOWN.equals(status.getLevel())) {
|
if (status != null && !Status.Level.UNKNOWN.equals(status.getLevel())) {
|
||||||
|
|
@ -61,7 +61,7 @@ public class StatusPageHandler implements PageHandler {
|
||||||
if ("status".equals(url.getPath())) {
|
if ("status".equals(url.getPath())) {
|
||||||
return new Page("", "", "", status.getLevel().toString());
|
return new Page("", "", "", status.getLevel().toString());
|
||||||
} else {
|
} else {
|
||||||
List<String> row = new ArrayList<String>();
|
List<String> row = new ArrayList<>();
|
||||||
row.add("summary");
|
row.add("summary");
|
||||||
row.add(getLevelHtml(status.getLevel()));
|
row.add(getLevelHtml(status.getLevel()));
|
||||||
row.add("<a href=\"/status\" target=\"_blank\">summary</a>");
|
row.add("<a href=\"/status\" target=\"_blank\">summary</a>");
|
||||||
|
|
|
||||||
|
|
@ -44,49 +44,49 @@ public class SystemPageHandler implements PageHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page handle(URL url) {
|
public Page handle(URL url) {
|
||||||
List<List<String>> rows = new ArrayList<List<String>>();
|
List<List<String>> rows = new ArrayList<>();
|
||||||
List<String> row;
|
List<String> row;
|
||||||
|
|
||||||
row = new ArrayList<String>();
|
row = new ArrayList<>();
|
||||||
row.add("Version");
|
row.add("Version");
|
||||||
row.add(Version.getVersion(SystemPageHandler.class, "2.0.0"));
|
row.add(Version.getVersion(SystemPageHandler.class, "2.0.0"));
|
||||||
rows.add(row);
|
rows.add(row);
|
||||||
|
|
||||||
row = new ArrayList<String>();
|
row = new ArrayList<>();
|
||||||
row.add("Host");
|
row.add("Host");
|
||||||
String address = NetUtils.getLocalHost();
|
String address = NetUtils.getLocalHost();
|
||||||
row.add(NetUtils.getHostName(address) + "/" + address);
|
row.add(NetUtils.getHostName(address) + "/" + address);
|
||||||
rows.add(row);
|
rows.add(row);
|
||||||
|
|
||||||
row = new ArrayList<String>();
|
row = new ArrayList<>();
|
||||||
row.add("OS");
|
row.add("OS");
|
||||||
row.add(System.getProperty("os.name") + " " + System.getProperty("os.version"));
|
row.add(System.getProperty("os.name") + " " + System.getProperty("os.version"));
|
||||||
rows.add(row);
|
rows.add(row);
|
||||||
|
|
||||||
row = new ArrayList<String>();
|
row = new ArrayList<>();
|
||||||
row.add("JVM");
|
row.add("JVM");
|
||||||
row.add(System.getProperty("java.runtime.name") + " " + System.getProperty("java.runtime.version") + ",<br/>"
|
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.name") + " " + System.getProperty("java.vm.version") + " "
|
||||||
+ System.getProperty("java.vm.info", ""));
|
+ System.getProperty("java.vm.info", ""));
|
||||||
rows.add(row);
|
rows.add(row);
|
||||||
|
|
||||||
row = new ArrayList<String>();
|
row = new ArrayList<>();
|
||||||
row.add("CPU");
|
row.add("CPU");
|
||||||
row.add(System.getProperty("os.arch", "") + ", "
|
row.add(System.getProperty("os.arch", "") + ", "
|
||||||
+ String.valueOf(Runtime.getRuntime().availableProcessors()) + " cores");
|
+ String.valueOf(Runtime.getRuntime().availableProcessors()) + " cores");
|
||||||
rows.add(row);
|
rows.add(row);
|
||||||
|
|
||||||
row = new ArrayList<String>();
|
row = new ArrayList<>();
|
||||||
row.add("Locale");
|
row.add("Locale");
|
||||||
row.add(Locale.getDefault().toString() + "/" + System.getProperty("file.encoding"));
|
row.add(Locale.getDefault().toString() + "/" + System.getProperty("file.encoding"));
|
||||||
rows.add(row);
|
rows.add(row);
|
||||||
|
|
||||||
row = new ArrayList<String>();
|
row = new ArrayList<>();
|
||||||
row.add("Uptime");
|
row.add("Uptime");
|
||||||
row.add(formatUptime(ManagementFactory.getRuntimeMXBean().getUptime()));
|
row.add(formatUptime(ManagementFactory.getRuntimeMXBean().getUptime()));
|
||||||
rows.add(row);
|
rows.add(row);
|
||||||
|
|
||||||
row = new ArrayList<String>();
|
row = new ArrayList<>();
|
||||||
row.add("Time");
|
row.add("Time");
|
||||||
row.add(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS Z").format(new Date()));
|
row.add(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS Z").format(new Date()));
|
||||||
rows.add(row);
|
rows.add(row);
|
||||||
|
|
|
||||||
|
|
@ -353,7 +353,7 @@ public class RpcContext {
|
||||||
final T o = callable.call();
|
final T o = callable.call();
|
||||||
// local invoke will return directly
|
// local invoke will return directly
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
FutureTask<T> f = new FutureTask<T>(new Callable<T>() {
|
FutureTask<T> f = new FutureTask<>(new Callable<T>() {
|
||||||
@Override
|
@Override
|
||||||
public T call() throws Exception {
|
public T call() throws Exception {
|
||||||
return o;
|
return o;
|
||||||
|
|
|
||||||
|
|
@ -162,14 +162,14 @@ public class RpcInvocation implements Invocation, Serializable {
|
||||||
|
|
||||||
public void setAttachment(String key, String value) {
|
public void setAttachment(String key, String value) {
|
||||||
if (attachments == null) {
|
if (attachments == null) {
|
||||||
attachments = new HashMap<String, String>();
|
attachments = new HashMap<>();
|
||||||
}
|
}
|
||||||
attachments.put(key, value);
|
attachments.put(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAttachmentIfAbsent(String key, String value) {
|
public void setAttachmentIfAbsent(String key, String value) {
|
||||||
if (attachments == null) {
|
if (attachments == null) {
|
||||||
attachments = new HashMap<String, String>();
|
attachments = new HashMap<>();
|
||||||
}
|
}
|
||||||
if (!attachments.containsKey(key)) {
|
if (!attachments.containsKey(key)) {
|
||||||
attachments.put(key, value);
|
attachments.put(key, value);
|
||||||
|
|
@ -181,7 +181,7 @@ public class RpcInvocation implements Invocation, Serializable {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.attachments == null) {
|
if (this.attachments == null) {
|
||||||
this.attachments = new HashMap<String, String>();
|
this.attachments = new HashMap<>();
|
||||||
}
|
}
|
||||||
this.attachments.putAll(attachments);
|
this.attachments.putAll(attachments);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ public final class {{className}} {
|
||||||
private static final StubServiceDescriptor serviceDescriptor = new StubServiceDescriptor(SERVICE_NAME,{{interfaceClassName}}.class);
|
private static final StubServiceDescriptor serviceDescriptor = new StubServiceDescriptor(SERVICE_NAME,{{interfaceClassName}}.class);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
org.apache.dubbo.rpc.protocol.tri.service.SchemaDescriptorRegistry.addSchemaDescriptor(SERVICE_NAME,{{outerClassName}}.getDescriptor());
|
||||||
StubSuppliers.addSupplier(SERVICE_NAME, {{className}}::newStub);
|
StubSuppliers.addSupplier(SERVICE_NAME, {{className}}::newStub);
|
||||||
StubSuppliers.addSupplier({{interfaceClassName}}.JAVA_SERVICE_NAME, {{className}}::newStub);
|
StubSuppliers.addSupplier({{interfaceClassName}}.JAVA_SERVICE_NAME, {{className}}::newStub);
|
||||||
StubSuppliers.addDescriptor(SERVICE_NAME, serviceDescriptor);
|
StubSuppliers.addDescriptor(SERVICE_NAME, serviceDescriptor);
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.testcontainers</groupId>
|
<groupId>org.testcontainers</groupId>
|
||||||
<artifactId>testcontainers</artifactId>
|
<artifactId>testcontainers</artifactId>
|
||||||
<version>1.19.6</version>
|
<version>1.19.8</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -346,6 +346,7 @@ public class ReferenceConfig<T> extends ReferenceConfigBase<T> {
|
||||||
if (CommonConstants.NATIVE_STUB.equals(getProxy())) {
|
if (CommonConstants.NATIVE_STUB.equals(getProxy())) {
|
||||||
serviceDescriptor = StubSuppliers.getServiceDescriptor(interfaceName);
|
serviceDescriptor = StubSuppliers.getServiceDescriptor(interfaceName);
|
||||||
repository.registerService(serviceDescriptor);
|
repository.registerService(serviceDescriptor);
|
||||||
|
setInterface(serviceDescriptor.getInterfaceName());
|
||||||
} else {
|
} else {
|
||||||
serviceDescriptor = repository.registerService(interfaceClass);
|
serviceDescriptor = repository.registerService(interfaceClass);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ public class ServiceConfig<T> extends ServiceConfigBase<T> {
|
||||||
/**
|
/**
|
||||||
* A random port cache, the different protocols who have no port specified have different random port
|
* A random port cache, the different protocols who have no port specified have different random port
|
||||||
*/
|
*/
|
||||||
private static final Map<String, Integer> RANDOM_PORT_MAP = new HashMap<String, Integer>();
|
private static final Map<String, Integer> RANDOM_PORT_MAP = new HashMap<>();
|
||||||
|
|
||||||
private Protocol protocolSPI;
|
private Protocol protocolSPI;
|
||||||
|
|
||||||
|
|
@ -651,7 +651,7 @@ public class ServiceConfig<T> extends ServiceConfigBase<T> {
|
||||||
|
|
||||||
private Map<String, String> buildAttributes(ProtocolConfig protocolConfig) {
|
private Map<String, String> buildAttributes(ProtocolConfig protocolConfig) {
|
||||||
|
|
||||||
Map<String, String> map = new HashMap<String, String>();
|
Map<String, String> map = new HashMap<>();
|
||||||
map.put(SIDE_KEY, PROVIDER_SIDE);
|
map.put(SIDE_KEY, PROVIDER_SIDE);
|
||||||
|
|
||||||
// append params with basic configs,
|
// append params with basic configs,
|
||||||
|
|
|
||||||
|
|
@ -329,7 +329,7 @@ public class DefaultApplicationDeployer extends AbstractDeployer<ApplicationMode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
metadataReportInstance.init(validMetadataReportConfigs);
|
metadataReportInstance.init(validMetadataReportConfigs);
|
||||||
if (!metadataReportInstance.inited()) {
|
if (!metadataReportInstance.isInitialized()) {
|
||||||
throw new IllegalStateException(String.format(
|
throw new IllegalStateException(String.format(
|
||||||
"%s MetadataConfigs found, but none of them is valid.", metadataReportConfigs.size()));
|
"%s MetadataConfigs found, but none of them is valid.", metadataReportConfigs.size()));
|
||||||
}
|
}
|
||||||
|
|
@ -382,6 +382,9 @@ public class DefaultApplicationDeployer extends AbstractDeployer<ApplicationMode
|
||||||
Optional<MetricsConfig> configOptional = configManager.getMetrics();
|
Optional<MetricsConfig> configOptional = configManager.getMetrics();
|
||||||
// If no specific metrics type is configured and there is no Prometheus dependency in the dependencies.
|
// If no specific metrics type is configured and there is no Prometheus dependency in the dependencies.
|
||||||
MetricsConfig metricsConfig = configOptional.orElse(new MetricsConfig(applicationModel));
|
MetricsConfig metricsConfig = configOptional.orElse(new MetricsConfig(applicationModel));
|
||||||
|
if (PROTOCOL_PROMETHEUS.equals(metricsConfig.getProtocol()) && !isSupportPrometheus()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (StringUtils.isBlank(metricsConfig.getProtocol())) {
|
if (StringUtils.isBlank(metricsConfig.getProtocol())) {
|
||||||
metricsConfig.setProtocol(isSupportPrometheus() ? PROTOCOL_PROMETHEUS : PROTOCOL_DEFAULT);
|
metricsConfig.setProtocol(isSupportPrometheus() ? PROTOCOL_PROMETHEUS : PROTOCOL_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.apache.dubbo.common.constants.CommonConstants.ANYHOST_VALUE;
|
import static org.apache.dubbo.common.constants.CommonConstants.ANYHOST_VALUE;
|
||||||
import static org.apache.dubbo.common.constants.CommonConstants.CLUSTER_KEY;
|
import static org.apache.dubbo.common.constants.CommonConstants.CLUSTER_KEY;
|
||||||
|
import static org.apache.dubbo.common.constants.CommonConstants.CONFIG_NAMESPACE_KEY;
|
||||||
import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_KEY;
|
import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_KEY;
|
||||||
import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_MONITOR_ADDRESS;
|
import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_MONITOR_ADDRESS;
|
||||||
import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_PROTOCOL;
|
import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_PROTOCOL;
|
||||||
|
|
@ -108,6 +109,7 @@ import static org.apache.dubbo.common.constants.RegistryConstants.DEFAULT_REGIST
|
||||||
import static org.apache.dubbo.common.constants.RegistryConstants.DEFAULT_REGISTER_MODE_INTERFACE;
|
import static org.apache.dubbo.common.constants.RegistryConstants.DEFAULT_REGISTER_MODE_INTERFACE;
|
||||||
import static org.apache.dubbo.common.constants.RegistryConstants.DUBBO_REGISTER_MODE_DEFAULT_KEY;
|
import static org.apache.dubbo.common.constants.RegistryConstants.DUBBO_REGISTER_MODE_DEFAULT_KEY;
|
||||||
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTER_MODE_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.RegistryConstants.REGISTRY_KEY;
|
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_KEY;
|
||||||
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_PROTOCOL;
|
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_PROTOCOL;
|
||||||
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_TYPE_KEY;
|
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_TYPE_KEY;
|
||||||
|
|
@ -209,7 +211,7 @@ public class ConfigValidationUtils {
|
||||||
address = ANYHOST_VALUE;
|
address = ANYHOST_VALUE;
|
||||||
}
|
}
|
||||||
if (!RegistryConfig.NO_AVAILABLE.equalsIgnoreCase(address)) {
|
if (!RegistryConfig.NO_AVAILABLE.equalsIgnoreCase(address)) {
|
||||||
Map<String, String> map = new HashMap<String, String>();
|
Map<String, String> map = new HashMap<>();
|
||||||
AbstractConfig.appendParameters(map, application);
|
AbstractConfig.appendParameters(map, application);
|
||||||
AbstractConfig.appendParameters(map, config);
|
AbstractConfig.appendParameters(map, config);
|
||||||
map.put(PATH_KEY, RegistryService.class.getName());
|
map.put(PATH_KEY, RegistryService.class.getName());
|
||||||
|
|
@ -217,6 +219,14 @@ public class ConfigValidationUtils {
|
||||||
if (!map.containsKey(PROTOCOL_KEY)) {
|
if (!map.containsKey(PROTOCOL_KEY)) {
|
||||||
map.put(PROTOCOL_KEY, DUBBO_PROTOCOL);
|
map.put(PROTOCOL_KEY, DUBBO_PROTOCOL);
|
||||||
}
|
}
|
||||||
|
String registryCluster = config.getId();
|
||||||
|
if (isEmpty(registryCluster)) {
|
||||||
|
registryCluster = DEFAULT_KEY;
|
||||||
|
}
|
||||||
|
if (map.containsKey(CONFIG_NAMESPACE_KEY)) {
|
||||||
|
registryCluster += ":" + map.get(CONFIG_NAMESPACE_KEY);
|
||||||
|
}
|
||||||
|
map.put(REGISTRY_CLUSTER_KEY, registryCluster);
|
||||||
List<URL> urls = UrlUtils.parseURLs(address, map);
|
List<URL> urls = UrlUtils.parseURLs(address, map);
|
||||||
|
|
||||||
for (URL url : urls) {
|
for (URL url : urls) {
|
||||||
|
|
@ -309,7 +319,7 @@ public class ConfigValidationUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static URL loadMonitor(AbstractInterfaceConfig interfaceConfig, URL registryURL) {
|
public static URL loadMonitor(AbstractInterfaceConfig interfaceConfig, URL registryURL) {
|
||||||
Map<String, String> map = new HashMap<String, String>();
|
Map<String, String> map = new HashMap<>();
|
||||||
map.put(INTERFACE_KEY, MonitorService.class.getName());
|
map.put(INTERFACE_KEY, MonitorService.class.getName());
|
||||||
AbstractInterfaceConfig.appendRuntimeParameters(map);
|
AbstractInterfaceConfig.appendRuntimeParameters(map);
|
||||||
// set ip
|
// set ip
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@ import org.apache.dubbo.config.metadata.ExporterDeployListener;
|
||||||
import org.apache.dubbo.config.provider.impl.DemoServiceImpl;
|
import org.apache.dubbo.config.provider.impl.DemoServiceImpl;
|
||||||
import org.apache.dubbo.config.utils.ConfigValidationUtils;
|
import org.apache.dubbo.config.utils.ConfigValidationUtils;
|
||||||
import org.apache.dubbo.metadata.MetadataService;
|
import org.apache.dubbo.metadata.MetadataService;
|
||||||
|
import org.apache.dubbo.metadata.report.MetadataReport;
|
||||||
|
import org.apache.dubbo.metadata.report.MetadataReportInstance;
|
||||||
import org.apache.dubbo.monitor.MonitorService;
|
import org.apache.dubbo.monitor.MonitorService;
|
||||||
import org.apache.dubbo.registry.RegistryService;
|
import org.apache.dubbo.registry.RegistryService;
|
||||||
import org.apache.dubbo.rpc.Exporter;
|
import org.apache.dubbo.rpc.Exporter;
|
||||||
|
|
@ -50,10 +52,14 @@ import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
|
@ -61,10 +67,15 @@ import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.io.TempDir;
|
import org.junit.jupiter.api.io.TempDir;
|
||||||
|
|
||||||
|
import static org.apache.dubbo.common.constants.CommonConstants.CONFIG_NAMESPACE_KEY;
|
||||||
|
import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_KEY;
|
||||||
import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_MONITOR_ADDRESS;
|
import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_MONITOR_ADDRESS;
|
||||||
import static org.apache.dubbo.common.constants.CommonConstants.REMOTE_METADATA_STORAGE_TYPE;
|
import static org.apache.dubbo.common.constants.CommonConstants.REMOTE_METADATA_STORAGE_TYPE;
|
||||||
import static org.apache.dubbo.common.constants.CommonConstants.SHUTDOWN_WAIT_KEY;
|
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.CommonConstants.SHUTDOWN_WAIT_SECONDS_KEY;
|
||||||
|
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_CLUSTER_KEY;
|
||||||
|
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_KEY;
|
||||||
|
import static org.apache.dubbo.metadata.MetadataConstants.REPORT_CONSUMER_URL_KEY;
|
||||||
import static org.hamcrest.CoreMatchers.anything;
|
import static org.hamcrest.CoreMatchers.anything;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.hasEntry;
|
import static org.hamcrest.Matchers.hasEntry;
|
||||||
|
|
@ -139,13 +150,29 @@ class DubboBootstrapTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testLoadRegistries() {
|
void testLoadRegistries() {
|
||||||
SysProps.setProperty("dubbo.registry.address", "addr1");
|
|
||||||
|
|
||||||
ServiceConfig serviceConfig = new ServiceConfig();
|
ServiceConfig serviceConfig = new ServiceConfig();
|
||||||
serviceConfig.setInterface(DemoService.class);
|
serviceConfig.setInterface(DemoService.class);
|
||||||
serviceConfig.setRef(new DemoServiceImpl());
|
serviceConfig.setRef(new DemoServiceImpl());
|
||||||
serviceConfig.setApplication(new ApplicationConfig("testLoadRegistries"));
|
serviceConfig.setApplication(new ApplicationConfig("testLoadRegistries"));
|
||||||
|
|
||||||
|
String registryId = "nacosRegistry";
|
||||||
|
String namespace1 = "test";
|
||||||
|
RegistryConfig registryConfig = new RegistryConfig();
|
||||||
|
registryConfig.setId(registryId);
|
||||||
|
registryConfig.setAddress("nacos://addr1:8848");
|
||||||
|
Map<String, String> registryParamMap = Maps.newHashMap();
|
||||||
|
registryParamMap.put(CONFIG_NAMESPACE_KEY, namespace1);
|
||||||
|
registryConfig.setParameters(registryParamMap);
|
||||||
|
|
||||||
|
String namespace2 = "test2";
|
||||||
|
RegistryConfig registryConfig2 = new RegistryConfig();
|
||||||
|
registryConfig2.setAddress("polaris://addr1:9999");
|
||||||
|
Map<String, String> registryParamMap2 = Maps.newHashMap();
|
||||||
|
registryParamMap2.put(CONFIG_NAMESPACE_KEY, namespace2);
|
||||||
|
registryConfig2.setParameters(registryParamMap2);
|
||||||
|
|
||||||
|
serviceConfig.setRegistries(Arrays.asList(registryConfig, registryConfig2));
|
||||||
|
|
||||||
// load configs from props
|
// load configs from props
|
||||||
DubboBootstrap.getInstance().initialize();
|
DubboBootstrap.getInstance().initialize();
|
||||||
|
|
||||||
|
|
@ -154,16 +181,104 @@ class DubboBootstrapTest {
|
||||||
// ApplicationModel.defaultModel().getEnvironment().setDynamicConfiguration(new
|
// ApplicationModel.defaultModel().getEnvironment().setDynamicConfiguration(new
|
||||||
// CompositeDynamicConfiguration());
|
// CompositeDynamicConfiguration());
|
||||||
List<URL> urls = ConfigValidationUtils.loadRegistries(serviceConfig, true);
|
List<URL> urls = ConfigValidationUtils.loadRegistries(serviceConfig, true);
|
||||||
Assertions.assertEquals(2, urls.size());
|
Assertions.assertEquals(4, urls.size());
|
||||||
for (URL url : urls) {
|
|
||||||
|
Map<String, List<URL>> urlsMap =
|
||||||
|
urls.stream().collect(Collectors.groupingBy(url -> url.getParameter(REGISTRY_KEY)));
|
||||||
|
Assertions.assertEquals(2, urlsMap.get("nacos").size());
|
||||||
|
for (URL url : urlsMap.get("nacos")) {
|
||||||
Assertions.assertTrue(url.getProtocol().contains("registry"));
|
Assertions.assertTrue(url.getProtocol().contains("registry"));
|
||||||
Assertions.assertEquals("addr1:9090", url.getAddress());
|
Assertions.assertEquals("addr1:8848", url.getAddress());
|
||||||
Assertions.assertEquals(RegistryService.class.getName(), url.getPath());
|
Assertions.assertEquals(RegistryService.class.getName(), url.getPath());
|
||||||
|
Assertions.assertEquals(registryId + ":" + namespace1, url.getParameter(REGISTRY_CLUSTER_KEY));
|
||||||
Assertions.assertTrue(url.getParameters().containsKey("timestamp"));
|
Assertions.assertTrue(url.getParameters().containsKey("timestamp"));
|
||||||
Assertions.assertTrue(url.getParameters().containsKey("pid"));
|
Assertions.assertTrue(url.getParameters().containsKey("pid"));
|
||||||
Assertions.assertTrue(url.getParameters().containsKey("registry"));
|
Assertions.assertTrue(url.getParameters().containsKey("registry"));
|
||||||
Assertions.assertTrue(url.getParameters().containsKey("dubbo"));
|
Assertions.assertTrue(url.getParameters().containsKey("dubbo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Assertions.assertEquals(2, urlsMap.get("polaris").size());
|
||||||
|
for (URL url : urlsMap.get("polaris")) {
|
||||||
|
Assertions.assertTrue(url.getProtocol().contains("registry"));
|
||||||
|
Assertions.assertEquals("addr1:9999", url.getAddress());
|
||||||
|
Assertions.assertEquals(RegistryService.class.getName(), url.getPath());
|
||||||
|
Assertions.assertEquals(DEFAULT_KEY + ":" + namespace2, url.getParameter(REGISTRY_CLUSTER_KEY));
|
||||||
|
Assertions.assertTrue(url.getParameters().containsKey("timestamp"));
|
||||||
|
Assertions.assertTrue(url.getParameters().containsKey("pid"));
|
||||||
|
Assertions.assertTrue(url.getParameters().containsKey("registry"));
|
||||||
|
Assertions.assertTrue(url.getParameters().containsKey("dubbo"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testRegistryWithMetadataReport() {
|
||||||
|
ServiceConfig serviceConfig = new ServiceConfig();
|
||||||
|
serviceConfig.setInterface(DemoService.class);
|
||||||
|
serviceConfig.setRef(new DemoServiceImpl());
|
||||||
|
|
||||||
|
List<RegistryConfig> registryConfigs = new ArrayList<>();
|
||||||
|
List<MetadataReportConfig> metadataReportConfigs = new ArrayList<>();
|
||||||
|
|
||||||
|
String registryId = "nacosRegistry";
|
||||||
|
String namespace1 = "test";
|
||||||
|
RegistryConfig registryConfig = new RegistryConfig();
|
||||||
|
registryConfig.setId(registryId);
|
||||||
|
registryConfig.setAddress(zkServerAddress);
|
||||||
|
Map<String, String> registryParamMap = Maps.newHashMap();
|
||||||
|
registryParamMap.put(CONFIG_NAMESPACE_KEY, namespace1);
|
||||||
|
registryConfig.setParameters(registryParamMap);
|
||||||
|
registryConfigs.add(registryConfig);
|
||||||
|
|
||||||
|
MetadataReportConfig metadataReportConfig = new MetadataReportConfig();
|
||||||
|
metadataReportConfig.setRegistry(registryId);
|
||||||
|
metadataReportConfig.setAddress(registryConfig.getAddress());
|
||||||
|
Map<String, String> metadataParamMap = Maps.newHashMap();
|
||||||
|
metadataParamMap.put(CONFIG_NAMESPACE_KEY, namespace1);
|
||||||
|
metadataParamMap.put(REPORT_CONSUMER_URL_KEY, Boolean.TRUE.toString());
|
||||||
|
metadataReportConfig.setParameters(metadataParamMap);
|
||||||
|
metadataReportConfig.setReportMetadata(true);
|
||||||
|
metadataReportConfigs.add(metadataReportConfig);
|
||||||
|
|
||||||
|
String namespace2 = "test2";
|
||||||
|
RegistryConfig registryConfig2 = new RegistryConfig();
|
||||||
|
registryConfig2.setAddress(zkServerAddress);
|
||||||
|
Map<String, String> registryParamMap2 = Maps.newHashMap();
|
||||||
|
registryParamMap2.put(CONFIG_NAMESPACE_KEY, namespace2);
|
||||||
|
registryConfig2.setParameters(registryParamMap2);
|
||||||
|
registryConfigs.add(registryConfig2);
|
||||||
|
|
||||||
|
MetadataReportConfig metadataReportConfig2 = new MetadataReportConfig();
|
||||||
|
metadataReportConfig2.setAddress(registryConfig2.getAddress());
|
||||||
|
Map<String, String> metadataParamMap2 = Maps.newHashMap();
|
||||||
|
metadataParamMap2.put(CONFIG_NAMESPACE_KEY, namespace2);
|
||||||
|
metadataParamMap2.put(REPORT_CONSUMER_URL_KEY, Boolean.TRUE.toString());
|
||||||
|
metadataReportConfig2.setParameters(metadataParamMap2);
|
||||||
|
metadataReportConfig2.setReportMetadata(true);
|
||||||
|
metadataReportConfigs.add(metadataReportConfig2);
|
||||||
|
|
||||||
|
serviceConfig.setRegistries(registryConfigs);
|
||||||
|
|
||||||
|
DubboBootstrap.getInstance()
|
||||||
|
.application(new ApplicationConfig("testRegistryWithMetadataReport"))
|
||||||
|
.registries(registryConfigs)
|
||||||
|
.metadataReports(metadataReportConfigs)
|
||||||
|
.service(serviceConfig)
|
||||||
|
.protocol(new ProtocolConfig(CommonConstants.DUBBO_PROTOCOL, -1))
|
||||||
|
.start();
|
||||||
|
|
||||||
|
ApplicationModel applicationModel = DubboBootstrap.getInstance().getApplicationModel();
|
||||||
|
MetadataReportInstance metadataReportInstance =
|
||||||
|
applicationModel.getBeanFactory().getBean(MetadataReportInstance.class);
|
||||||
|
|
||||||
|
Map<String, MetadataReport> metadataReports = metadataReportInstance.getMetadataReports(true);
|
||||||
|
Assertions.assertEquals(2, metadataReports.size());
|
||||||
|
|
||||||
|
List<URL> urls = ConfigValidationUtils.loadRegistries(serviceConfig, true);
|
||||||
|
Assertions.assertEquals(4, urls.size());
|
||||||
|
|
||||||
|
for (URL url : urls) {
|
||||||
|
Assertions.assertTrue(metadataReports.containsKey(url.getParameter(REGISTRY_CLUSTER_KEY)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,13 @@
|
||||||
package org.apache.dubbo.config.deploy;
|
package org.apache.dubbo.config.deploy;
|
||||||
|
|
||||||
import org.apache.dubbo.common.utils.Assert;
|
import org.apache.dubbo.common.utils.Assert;
|
||||||
|
import org.apache.dubbo.config.MetricsConfig;
|
||||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.apache.dubbo.common.constants.MetricsConstants.PROTOCOL_PROMETHEUS;
|
||||||
|
|
||||||
class DefaultApplicationDeployerTest {
|
class DefaultApplicationDeployerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -29,4 +32,13 @@ class DefaultApplicationDeployerTest {
|
||||||
new DefaultApplicationDeployer(ApplicationModel.defaultModel()).isSupportPrometheus();
|
new DefaultApplicationDeployer(ApplicationModel.defaultModel()).isSupportPrometheus();
|
||||||
Assert.assertTrue(supportPrometheus, "DefaultApplicationDeployer.isSupportPrometheus() should return true");
|
Assert.assertTrue(supportPrometheus, "DefaultApplicationDeployer.isSupportPrometheus() should return true");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void isImportPrometheus() {
|
||||||
|
MetricsConfig metricsConfig = new MetricsConfig();
|
||||||
|
metricsConfig.setProtocol("prometheus");
|
||||||
|
boolean importPrometheus = PROTOCOL_PROMETHEUS.equals(metricsConfig.getProtocol())
|
||||||
|
&& !DefaultApplicationDeployer.isSupportPrometheus();
|
||||||
|
Assert.assertTrue(!importPrometheus, " should return false");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,6 @@ class MultipleRegistryCenterExportMetadataIntegrationTest implements Integration
|
||||||
@AfterEach
|
@AfterEach
|
||||||
public void tearDown() throws IOException {
|
public void tearDown() throws IOException {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
PROVIDER_APPLICATION_NAME = null;
|
|
||||||
serviceConfig = null;
|
serviceConfig = null;
|
||||||
// The exported service has been unexported
|
// The exported service has been unexported
|
||||||
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,6 @@ class MultipleRegistryCenterExportProviderIntegrationTest implements Integration
|
||||||
@AfterEach
|
@AfterEach
|
||||||
public void tearDown() throws IOException {
|
public void tearDown() throws IOException {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
PROVIDER_APPLICATION_NAME = null;
|
|
||||||
serviceConfig = null;
|
serviceConfig = null;
|
||||||
// The exported service has been unexported
|
// The exported service has been unexported
|
||||||
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,6 @@ class MultipleRegistryCenterInjvmIntegrationTest implements IntegrationTest {
|
||||||
@AfterEach
|
@AfterEach
|
||||||
public void tearDown() throws IOException {
|
public void tearDown() throws IOException {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
PROVIDER_APPLICATION_NAME = null;
|
|
||||||
serviceConfig = null;
|
serviceConfig = null;
|
||||||
// The exported service has been unexported
|
// The exported service has been unexported
|
||||||
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,6 @@ class MultipleRegistryCenterServiceDiscoveryRegistryIntegrationTest implements I
|
||||||
@AfterEach
|
@AfterEach
|
||||||
public void tearDown() throws IOException {
|
public void tearDown() throws IOException {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
PROVIDER_APPLICATION_NAME = null;
|
|
||||||
serviceConfig = null;
|
serviceConfig = null;
|
||||||
// TODO: we need to check whether this scenario is normal
|
// TODO: we need to check whether this scenario is normal
|
||||||
// TODO: the Exporter and ServiceDiscoveryRegistry are same in multiple registry center
|
// TODO: the Exporter and ServiceDiscoveryRegistry are same in multiple registry center
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,6 @@ class SingleRegistryCenterExportMetadataIntegrationTest implements IntegrationTe
|
||||||
@AfterEach
|
@AfterEach
|
||||||
public void tearDown() throws IOException {
|
public void tearDown() throws IOException {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
PROVIDER_APPLICATION_NAME = null;
|
|
||||||
serviceConfig = null;
|
serviceConfig = null;
|
||||||
// The exported service has been unexported
|
// The exported service has been unexported
|
||||||
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,6 @@ class SingleRegistryCenterExportProviderIntegrationTest implements IntegrationTe
|
||||||
@AfterEach
|
@AfterEach
|
||||||
public void tearDown() throws IOException {
|
public void tearDown() throws IOException {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
PROVIDER_APPLICATION_NAME = null;
|
|
||||||
serviceConfig = null;
|
serviceConfig = null;
|
||||||
// The exported service has been unexported
|
// The exported service has been unexported
|
||||||
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,6 @@ class SingleRegistryCenterInjvmIntegrationTest implements IntegrationTest {
|
||||||
@AfterEach
|
@AfterEach
|
||||||
public void tearDown() throws IOException {
|
public void tearDown() throws IOException {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
PROVIDER_APPLICATION_NAME = null;
|
|
||||||
serviceConfig = null;
|
serviceConfig = null;
|
||||||
// The exported service has been unexported
|
// The exported service has been unexported
|
||||||
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
Assertions.assertTrue(serviceListener.getExportedServices().isEmpty());
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ class ReferenceCacheTest {
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
DubboBootstrap.reset();
|
DubboBootstrap.reset();
|
||||||
MockReferenceConfig.setCounter(0);
|
MockReferenceConfig.setCounter(0);
|
||||||
|
XxxMockReferenceConfig.setCounter(0);
|
||||||
SimpleReferenceCache.CACHE_HOLDER.clear();
|
SimpleReferenceCache.CACHE_HOLDER.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.aspectj</groupId>
|
<groupId>org.aspectj</groupId>
|
||||||
<artifactId>aspectjweaver</artifactId>
|
<artifactId>aspectjweaver</artifactId>
|
||||||
<version>1.9.21.1</version>
|
<version>1.9.22.1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
||||||
|
|
@ -78,8 +78,7 @@ public abstract class AbstractAnnotationBeanPostProcessor
|
||||||
private final Class<? extends Annotation>[] annotationTypes;
|
private final Class<? extends Annotation>[] annotationTypes;
|
||||||
|
|
||||||
private final ConcurrentMap<String, AbstractAnnotationBeanPostProcessor.AnnotatedInjectionMetadata>
|
private final ConcurrentMap<String, AbstractAnnotationBeanPostProcessor.AnnotatedInjectionMetadata>
|
||||||
injectionMetadataCache = new ConcurrentHashMap<
|
injectionMetadataCache = new ConcurrentHashMap<>(CACHE_SIZE);
|
||||||
String, AbstractAnnotationBeanPostProcessor.AnnotatedInjectionMetadata>(CACHE_SIZE);
|
|
||||||
|
|
||||||
private ConfigurableListableBeanFactory beanFactory;
|
private ConfigurableListableBeanFactory beanFactory;
|
||||||
|
|
||||||
|
|
@ -98,7 +97,7 @@ public abstract class AbstractAnnotationBeanPostProcessor
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T> Collection<T> combine(Collection<? extends T>... elements) {
|
private static <T> Collection<T> combine(Collection<? extends T>... elements) {
|
||||||
List<T> allElements = new ArrayList<T>();
|
List<T> allElements = new ArrayList<>();
|
||||||
for (Collection<? extends T> e : elements) {
|
for (Collection<? extends T> e : elements) {
|
||||||
allElements.addAll(e);
|
allElements.addAll(e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ public abstract class AnnotationUtils {
|
||||||
|
|
||||||
Set<String> ignoreAttributeNamesSet = new HashSet<>(Arrays.asList(ignoreAttributeNames));
|
Set<String> ignoreAttributeNamesSet = new HashSet<>(Arrays.asList(ignoreAttributeNames));
|
||||||
|
|
||||||
Map<String, Object> actualAttributes = new LinkedHashMap<String, Object>();
|
Map<String, Object> actualAttributes = new LinkedHashMap<>();
|
||||||
|
|
||||||
for (Map.Entry<String, Object> annotationAttribute : annotationAttributes.entrySet()) {
|
for (Map.Entry<String, Object> annotationAttribute : annotationAttributes.entrySet()) {
|
||||||
|
|
||||||
|
|
@ -143,7 +143,7 @@ public abstract class AnnotationUtils {
|
||||||
|
|
||||||
if (ignoreDefaultValue && !isEmpty(annotationAttributes)) {
|
if (ignoreDefaultValue && !isEmpty(annotationAttributes)) {
|
||||||
|
|
||||||
List<String> attributeNamesToIgnore = new LinkedList<String>(asList(ignoreAttributeNames));
|
List<String> attributeNamesToIgnore = new LinkedList<>(asList(ignoreAttributeNames));
|
||||||
|
|
||||||
for (Map.Entry<String, Object> annotationAttribute : annotationAttributes.entrySet()) {
|
for (Map.Entry<String, Object> annotationAttribute : annotationAttributes.entrySet()) {
|
||||||
String attributeName = annotationAttribute.getKey();
|
String attributeName = annotationAttribute.getKey();
|
||||||
|
|
@ -444,21 +444,11 @@ public abstract class AnnotationUtils {
|
||||||
(_k) -> ClassUtils.isPresent(ANNOTATED_ELEMENT_UTILS_CLASS_NAME, classLoader))) {
|
(_k) -> ClassUtils.isPresent(ANNOTATED_ELEMENT_UTILS_CLASS_NAME, classLoader))) {
|
||||||
Class<?> annotatedElementUtilsClass = resolveClassName(ANNOTATED_ELEMENT_UTILS_CLASS_NAME, classLoader);
|
Class<?> annotatedElementUtilsClass = resolveClassName(ANNOTATED_ELEMENT_UTILS_CLASS_NAME, classLoader);
|
||||||
// getMergedAnnotation method appears in the Spring Framework 4.2
|
// getMergedAnnotation method appears in the Spring Framework 4.2
|
||||||
Method getMergedAnnotationMethod = findMethod(
|
Method getMergedAnnotationMethod =
|
||||||
annotatedElementUtilsClass,
|
findMethod(annotatedElementUtilsClass, "getMergedAnnotation", AnnotatedElement.class, Class.class);
|
||||||
"getMergedAnnotation",
|
|
||||||
AnnotatedElement.class,
|
|
||||||
Class.class,
|
|
||||||
boolean.class,
|
|
||||||
boolean.class);
|
|
||||||
if (getMergedAnnotationMethod != null) {
|
if (getMergedAnnotationMethod != null) {
|
||||||
mergedAnnotation = (Annotation) invokeMethod(
|
mergedAnnotation =
|
||||||
getMergedAnnotationMethod,
|
(Annotation) invokeMethod(getMergedAnnotationMethod, null, annotatedElement, annotationType);
|
||||||
null,
|
|
||||||
annotatedElement,
|
|
||||||
annotationType,
|
|
||||||
classValuesAsString,
|
|
||||||
nestedAnnotationsAsMap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ public abstract class PropertySourcesUtils {
|
||||||
public static Map<String, Object> getSubProperties(
|
public static Map<String, Object> getSubProperties(
|
||||||
PropertySources propertySources, PropertyResolver propertyResolver, String prefix) {
|
PropertySources propertySources, PropertyResolver propertyResolver, String prefix) {
|
||||||
|
|
||||||
Map<String, Object> subProperties = new LinkedHashMap<String, Object>();
|
Map<String, Object> subProperties = new LinkedHashMap<>();
|
||||||
|
|
||||||
String normalizedPrefix = normalizePrefix(prefix);
|
String normalizedPrefix = normalizePrefix(prefix);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,19 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
~ contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
~ this work for additional information regarding copyright ownership.
|
this work for additional information regarding copyright ownership.
|
||||||
~ The ASF licenses this file to You under the Apache License, Version 2.0
|
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 not use this file except in compliance with
|
||||||
~ the License. You may obtain a copy of the License at
|
the License. You may obtain a copy of the License at
|
||||||
~
|
|
||||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
~
|
|
||||||
~ Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
~ See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
~ limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ public class Main {
|
||||||
args = COMMA_SPLIT_PATTERN.split(config);
|
args = COMMA_SPLIT_PATTERN.split(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Container> containers = new ArrayList<Container>();
|
final List<Container> containers = new ArrayList<>();
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
containers.add(LOADER.getExtension(args[i]));
|
containers.add(LOADER.getExtension(args[i]));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,19 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
~ or more contributor license agreements. See the NOTICE file
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
~ distributed with this work for additional information
|
this work for additional information regarding copyright ownership.
|
||||||
~ regarding copyright ownership. The ASF licenses this file
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
~ to you under the Apache License, Version 2.0 (the
|
(the "License"); you may not use this file except in compliance with
|
||||||
~ "License"); you may not use this file except in compliance
|
the License. You may obtain a copy of the License at
|
||||||
~ with the License. You may obtain a copy of the License at
|
|
||||||
~
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
~
|
Unless required by applicable law or agreed to in writing, software
|
||||||
~ Unless required by applicable law or agreed to in writing,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
~ software distributed under the License is distributed on an
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
See the License for the specific language governing permissions and
|
||||||
~ KIND, either express or implied. See the License for the
|
limitations under the License.
|
||||||
~ specific language governing permissions and limitations
|
|
||||||
~ under the License.
|
|
||||||
-->
|
-->
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,19 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
~ or more contributor license agreements. See the NOTICE file
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
~ distributed with this work for additional information
|
this work for additional information regarding copyright ownership.
|
||||||
~ regarding copyright ownership. The ASF licenses this file
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
~ to you under the Apache License, Version 2.0 (the
|
(the "License"); you may not use this file except in compliance with
|
||||||
~ "License"); you may not use this file except in compliance
|
the License. You may obtain a copy of the License at
|
||||||
~ with the License. You may obtain a copy of the License at
|
|
||||||
~
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
~
|
Unless required by applicable law or agreed to in writing, software
|
||||||
~ Unless required by applicable law or agreed to in writing,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
~ software distributed under the License is distributed on an
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
See the License for the specific language governing permissions and
|
||||||
~ KIND, either express or implied. See the License for the
|
limitations under the License.
|
||||||
~ specific language governing permissions and limitations
|
|
||||||
~ under the License.
|
|
||||||
-->
|
-->
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,19 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
~ or more contributor license agreements. See the NOTICE file
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
~ distributed with this work for additional information
|
this work for additional information regarding copyright ownership.
|
||||||
~ regarding copyright ownership. The ASF licenses this file
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
~ to you under the Apache License, Version 2.0 (the
|
(the "License"); you may not use this file except in compliance with
|
||||||
~ "License"); you may not use this file except in compliance
|
the License. You may obtain a copy of the License at
|
||||||
~ with the License. You may obtain a copy of the License at
|
|
||||||
~
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
~
|
Unless required by applicable law or agreed to in writing, software
|
||||||
~ Unless required by applicable law or agreed to in writing,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
~ software distributed under the License is distributed on an
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
See the License for the specific language governing permissions and
|
||||||
~ KIND, either express or implied. See the License for the
|
limitations under the License.
|
||||||
~ specific language governing permissions and limitations
|
|
||||||
~ under the License.
|
|
||||||
-->
|
-->
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,19 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
~ or more contributor license agreements. See the NOTICE file
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
~ distributed with this work for additional information
|
this work for additional information regarding copyright ownership.
|
||||||
~ regarding copyright ownership. The ASF licenses this file
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
~ to you under the Apache License, Version 2.0 (the
|
(the "License"); you may not use this file except in compliance with
|
||||||
~ "License"); you may not use this file except in compliance
|
the License. You may obtain a copy of the License at
|
||||||
~ with the License. You may obtain a copy of the License at
|
|
||||||
~
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
~
|
Unless required by applicable law or agreed to in writing, software
|
||||||
~ Unless required by applicable law or agreed to in writing,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
~ software distributed under the License is distributed on an
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
See the License for the specific language governing permissions and
|
||||||
~ KIND, either express or implied. See the License for the
|
limitations under the License.
|
||||||
~ specific language governing permissions and limitations
|
|
||||||
~ under the License.
|
|
||||||
-->
|
-->
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue