Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize the logic in org.apache.dubbo.common.URL#getEncodedServiceKey() #4206

Open
ralf0131 opened this issue May 30, 2019 · 1 comment
Open
Milestone

Comments

@ralf0131
Copy link
Contributor

The currently implementation of org.apache.dubbo.common.URL#getEncodedServiceKey() is not elegant.

    public String getEncodedServiceKey() {
        String serviceKey = this.getServiceKey();
        serviceKey = serviceKey.replaceFirst("/", "*");
        return serviceKey;
    }

The purpose of replacing "/" with "*" is that Zookeeper does not support "/" as a valid character of key.

Proposal:

Add new parameter to getServiceKey(), for example: getServiceKey(String delimiter), and pass "/" or "*" in different scenario.

@kaori-seasons
Copy link
Contributor

目前的实施org.apache.dubbo.common.URL#getEncodedServiceKey() 并不优雅。

    public  String getEncodedServiceKey(){
         String serviceKey =  thisgetServiceKey(); 
        serviceKey = serviceKeyreplaceFirst(“ / ”,“ * ”);
        return serviceKey; 
    }

用“*”替换“/”的目的是Zookeeper不支持“/”作为密钥的有效字符。

提案:

添加新参数getServiceKey(),例如:getServiceKey(String delimiter),并在不同的场景中传递“/”或“*”。

Do the different scenarios referred to here refer to different registration centers? I didn't understand what you mean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants