Skip to content

Commit 8035ecd

Browse files
cityironmastertiller
authored andcommitted
Support customized origin parser in legacy Dubbo 2.6.x adapter (alibaba#1555)
1 parent 4bab731 commit 8035ecd

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

sentinel-adapter/sentinel-dubbo-adapter/README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,10 @@ flow control, degrade or system load protection. You can implement your own `Dub
6969
and then register to `DubboAdapterGlobalConfig`.
7070
If no fallback is configured, Sentinel will wrap the `BlockException` as the fallback result.
7171

72-
Besides, we can also leverage [Dubbo mock mechanism](http://dubbo.apache.org/en-us/docs/user/demos/local-mock.html) to provide fallback implementation of degraded Dubbo services.
72+
Besides, we can also leverage [Dubbo mock mechanism](http://dubbo.apache.org/en-us/docs/user/demos/local-mock.html) to provide fallback implementation of degraded Dubbo services.
73+
74+
## Global dubbo provider origin parse
75+
76+
Sentinel Dubbo Adapter supports global origin parse for provider.
77+
You can implement your own `DubboOriginParser` interface
78+
and then register to `DubboOriginParserRegistry`. If no originParse is configured, Sentinel will user dubbo url property application.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright 1999-2020 Alibaba Group Holding Ltd.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.alibaba.csp.sentinel.adapter.dubbo.origin;
17+
18+
/**
19+
* Global origin parser registry for Dubbo.
20+
*
21+
* @author tiecheng
22+
*/
23+
public final class DubboOriginParserRegistry {
24+
25+
private static volatile DubboOriginParser dubboOriginParser = new DefaultDubboOriginParser();
26+
27+
public static DubboOriginParser getDubboOriginParser() {
28+
return dubboOriginParser;
29+
}
30+
31+
public static void setDubboOriginParser(DubboOriginParser dubboOriginParser) {
32+
DubboOriginParserRegistry.dubboOriginParser = dubboOriginParser;
33+
}
34+
35+
private DubboOriginParserRegistry() {}
36+
37+
}

0 commit comments

Comments
 (0)