This is an automated email from the ASF dual-hosted git repository.
lizhanhui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop by this push:
new 9e4c624ea send async,time is not counted until the task is executed
(#4839)
9e4c624ea is described below
commit 9e4c624ea14f02ce75f7ae62560bc7b31af106cc
Author: zhaows <[email protected]>
AuthorDate: Tue Aug 23 19:00:58 2022 +0800
send async,time is not counted until the task is executed (#4839)
---
.../client/impl/producer/DefaultMQProducerImpl.java | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git
a/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
b/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
index 030d5da15..cb6343755 100644
---
a/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
+++
b/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
@@ -491,22 +491,15 @@ public class DefaultMQProducerImpl implements
MQProducerInner {
@Deprecated
public void send(final Message msg, final SendCallback sendCallback, final
long timeout)
throws MQClientException, RemotingException, InterruptedException {
- final long beginStartTime = System.currentTimeMillis();
ExecutorService executor = this.getAsyncSenderExecutor();
try {
executor.submit(new Runnable() {
@Override
public void run() {
- long costTime = System.currentTimeMillis() -
beginStartTime;
- if (timeout > costTime) {
- try {
- sendDefaultImpl(msg, CommunicationMode.ASYNC,
sendCallback, timeout - costTime);
- } catch (Exception e) {
- sendCallback.onException(e);
- }
- } else {
- sendCallback.onException(
- new RemotingTooMuchRequestException("DEFAULT ASYNC
send call timeout"));
+ try {
+ sendDefaultImpl(msg, CommunicationMode.ASYNC,
sendCallback, timeout);
+ } catch (Exception e) {
+ sendCallback.onException(e);
}
}