cbornet commented on a change in pull request #6720:
URL: https://github.com/apache/pulsar/pull/6720#discussion_r525166711



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java
##########
@@ -218,24 +205,20 @@ public boolean readCompacted() {
      *
      * @return a SendMessageInfo object that contains the detail of what was 
sent to consumer
      */
-
-    public ChannelPromise sendMessages(final List<Entry> entries, 
EntryBatchSizes batchSizes, EntryBatchIndexesAcks batchIndexesAcks,
+    public Future<Void> sendMessages(final List<Entry> entries, 
EntryBatchSizes batchSizes, EntryBatchIndexesAcks batchIndexesAcks,
                int totalMessages, long totalBytes, long totalChunkedMessages, 
RedeliveryTracker redeliveryTracker) {
         this.lastConsumedTimestamp = System.currentTimeMillis();
-        final ChannelHandlerContext ctx = cnx.ctx();
-        final ChannelPromise writePromise = ctx.newPromise();
 
         if (entries.isEmpty() || totalMessages == 0) {
             if (log.isDebugEnabled()) {
                 log.debug("[{}-{}] List of messages is empty, triggering write 
future immediately for consumerId {}",
                         topicName, subscription, consumerId);
             }
-            writePromise.setSuccess();
             batchSizes.recyle();
             if (batchIndexesAcks != null) {
                 batchIndexesAcks.recycle();
             }
-            return writePromise;
+            return ImmediateEventExecutor.INSTANCE.newSucceededFuture(null);

Review comment:
       I added a `newPromise` method to `TransportCnx` which `ServerCnx` 
implements with `ctx.newPromise()` so there's no change in how it works for the 
regular `ServerCnx`. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to