ivankelly commented on a change in pull request #2103: Issue 1433: Expose batch 
flushAsync() and flush() methods in Producer
URL: https://github.com/apache/incubator-pulsar/pull/2103#discussion_r200955734
 
 

 ##########
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
 ##########
 @@ -1218,7 +1223,22 @@ public void run(Timeout timeout) throws Exception {
     };
 
     @Override
-    protected void flush() {
+    public CompletableFuture<Void> flushAsync() {
+        if (isBatchMessagingEnabled()) {
+            CompletableFuture<MessageId> lastSendFuture;
+            synchronized (ProducerImpl.this) {
+                batchMessageAndSend();
 
 Review comment:
   batchMessageAndSend is a no-op is batching is disabled, so this whole method 
could be just
   ```
   public CompletableFuture<Void> flushAsync() {
       synchronized (ProducerImpl.this) {
           batchMessageAndSend();
           return lastSendFuture.thenApply(ignored -> null);
       }
   }
   ```

----------------------------------------------------------------
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