apache / apache/dubbo

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

Open
#4,206 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
41.6k
Forks
26.4k
Avg merge
15h 13m
Merged PRs (30d)
4

Description

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

```java
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.