zhouxinyu commented on a change in pull request #219: [ROCKETMQ-355] Client 
asyncSend is not fully async
URL: https://github.com/apache/rocketmq/pull/219#discussion_r161970219
 
 

 ##########
 File path: 
client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
 ##########
 @@ -409,17 +410,32 @@ public MessageExt queryMessageByUniqKey(String topic, 
String uniqKey)
     /**
      * DEFAULT ASYNC -------------------------------------------------------
      */
-    public void send(Message msg,
-        SendCallback sendCallback) throws MQClientException, 
RemotingException, InterruptedException {
+    public void send(Message msg, SendCallback sendCallback) {
         send(msg, sendCallback, this.defaultMQProducer.getSendMsgTimeout());
     }
 
-    public void send(Message msg, SendCallback sendCallback, long timeout)
-        throws MQClientException, RemotingException, InterruptedException {
-        try {
-            this.sendDefaultImpl(msg, CommunicationMode.ASYNC, sendCallback, 
timeout);
-        } catch (MQBrokerException e) {
-            throw new MQClientException("unknownn exception", e);
+    public void send(final Message msg, final SendCallback sendCallback, final 
long timeout) {
+        this.getCallbackExecutor().submit(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    sendDefaultImpl(msg, CommunicationMode.ASYNC, 
sendCallback, timeout);
+                } catch (Exception e) {
+                    handleCallbackException(e, sendCallback);
 
 Review comment:
   How to handle the `RejectedExecutionException`? While it has the similar 
effect as `NettyRemotingAbstract.semaphoreAsync` -:)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to