未验证 提交 e1e2333c 编写于 作者: R rongtong 提交者: GitHub

Merge pull request #2024 from rushsky518/mqclient

[ISSUE #2025] Refactor  MQClientAPIImpl#processSendResponse
...@@ -643,29 +643,27 @@ public class MQClientAPIImpl { ...@@ -643,29 +643,27 @@ public class MQClientAPIImpl {
final Message msg, final Message msg,
final RemotingCommand response final RemotingCommand response
) throws MQBrokerException, RemotingCommandException { ) throws MQBrokerException, RemotingCommandException {
SendStatus sendStatus;
switch (response.getCode()) { switch (response.getCode()) {
case ResponseCode.FLUSH_DISK_TIMEOUT: case ResponseCode.FLUSH_DISK_TIMEOUT: {
case ResponseCode.FLUSH_SLAVE_TIMEOUT:
case ResponseCode.SLAVE_NOT_AVAILABLE: {
}
case ResponseCode.SUCCESS: {
SendStatus sendStatus = SendStatus.SEND_OK;
switch (response.getCode()) {
case ResponseCode.FLUSH_DISK_TIMEOUT:
sendStatus = SendStatus.FLUSH_DISK_TIMEOUT; sendStatus = SendStatus.FLUSH_DISK_TIMEOUT;
break; break;
case ResponseCode.FLUSH_SLAVE_TIMEOUT: }
case ResponseCode.FLUSH_SLAVE_TIMEOUT: {
sendStatus = SendStatus.FLUSH_SLAVE_TIMEOUT; sendStatus = SendStatus.FLUSH_SLAVE_TIMEOUT;
break; break;
case ResponseCode.SLAVE_NOT_AVAILABLE: }
case ResponseCode.SLAVE_NOT_AVAILABLE: {
sendStatus = SendStatus.SLAVE_NOT_AVAILABLE; sendStatus = SendStatus.SLAVE_NOT_AVAILABLE;
break; break;
case ResponseCode.SUCCESS: }
case ResponseCode.SUCCESS: {
sendStatus = SendStatus.SEND_OK; sendStatus = SendStatus.SEND_OK;
break; break;
default: }
assert false; default: {
break; throw new MQBrokerException(response.getCode(), response.getRemark());
}
} }
SendMessageResponseHeader responseHeader = SendMessageResponseHeader responseHeader =
...@@ -704,12 +702,6 @@ public class MQClientAPIImpl { ...@@ -704,12 +702,6 @@ public class MQClientAPIImpl {
sendResult.setRegionId(regionId); sendResult.setRegionId(regionId);
return sendResult; return sendResult;
} }
default:
break;
}
throw new MQBrokerException(response.getCode(), response.getRemark());
}
public PullResult pullMessage( public PullResult pullMessage(
final String addr, final String addr,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册