Skip to content

Commit

Permalink
[fix bug ] fix @TarsClient annotation parsing is incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
TimmyYu committed Dec 6, 2019
1 parent f94e80a commit eca9fd1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
15 changes: 12 additions & 3 deletions core/src/main/java/com/qq/tars/client/ServantProxyConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,20 @@ public String getSetDivision() {
}

public void setSetDivision(String setDivision) {
if (StringUtils.isEmpty(setDivision)) {
return;
}
this.setDivision = setDivision;
String[] tmp = StringUtils.split(setDivision, ".");
this.slaveSetName = tmp[0];
this.slaveSetArea = tmp[1];
this.slaveSetID = tmp[2];
if (tmp.length >= 3) {
this.slaveSetName = tmp[0];
this.slaveSetArea = tmp[1];
this.slaveSetID = tmp[2];
} else {
this.slaveName = "";
this.slaveSetArea = "";
this.slaveSetID = "";
}
this.updateSlaveName();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ private void processFields(Object bean, Field[] declaredFields) {
ServantProxyConfig config = new ServantProxyConfig(objName);
CommunicatorConfig communicatorConfig = ConfigurationManager.getInstance().getServerConfig().getCommunicatorConfig();
config.setModuleName(communicatorConfig.getModuleName(), communicatorConfig.isEnableSet(), communicatorConfig.getSetDivision());
if (annotation.setDivision() != null) {
if (StringUtils.isNotEmpty(annotation.setDivision())) {
config.setEnableSet(true);
config.setSetDivision(annotation.setDivision());
}
config.setSetDivision(annotation.setDivision());
config.setConnections(annotation.connections());
config.setConnectTimeout(annotation.connectTimeout());
config.setSyncTimeout(annotation.syncTimeout());
Expand Down

0 comments on commit eca9fd1

Please sign in to comment.