kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gwens...@apache.org
Subject kafka git commit: KAFKA-5042: InFlightRequests#isEmpty() always returns false
Date Fri, 07 Apr 2017 17:14:16 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk e19bf3f24 -> a4c50687f


KAFKA-5042: InFlightRequests#isEmpty() always returns false

Author: Ismael Juma <ismael@juma.me.uk>

Reviewers: Gwen Shapira

Closes #2823 from ijuma/kafka-5042-fix-inflight-requests-is-empty


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/a4c50687
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/a4c50687
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/a4c50687

Branch: refs/heads/trunk
Commit: a4c50687f6a5a5a7ea9e523df7c55355441c7ffa
Parents: e19bf3f
Author: Ismael Juma <ismael@juma.me.uk>
Authored: Fri Apr 7 10:14:06 2017 -0700
Committer: Gwen Shapira <cshapi@gmail.com>
Committed: Fri Apr 7 10:14:06 2017 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/kafka/clients/InFlightRequests.java  | 2 +-
 .../src/test/java/org/apache/kafka/clients/NetworkClientTest.java | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/a4c50687/clients/src/main/java/org/apache/kafka/clients/InFlightRequests.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/clients/InFlightRequests.java b/clients/src/main/java/org/apache/kafka/clients/InFlightRequests.java
index a29075d..642f028 100644
--- a/clients/src/main/java/org/apache/kafka/clients/InFlightRequests.java
+++ b/clients/src/main/java/org/apache/kafka/clients/InFlightRequests.java
@@ -131,7 +131,7 @@ final class InFlightRequests {
             if (!deque.isEmpty())
                 return false;
         }
-        return false;
+        return true;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/kafka/blob/a4c50687/clients/src/test/java/org/apache/kafka/clients/NetworkClientTest.java
----------------------------------------------------------------------
diff --git a/clients/src/test/java/org/apache/kafka/clients/NetworkClientTest.java b/clients/src/test/java/org/apache/kafka/clients/NetworkClientTest.java
index 5af2a26..1ee9d0f 100644
--- a/clients/src/test/java/org/apache/kafka/clients/NetworkClientTest.java
+++ b/clients/src/test/java/org/apache/kafka/clients/NetworkClientTest.java
@@ -120,10 +120,12 @@ public class NetworkClientTest {
         assertEquals("There should be 1 in-flight request after send", 1,
                 client.inFlightRequestCount(node.idString()));
         assertTrue(client.hasInFlightRequests(node.idString()));
+        assertTrue(client.hasInFlightRequests());
 
         client.close(node.idString());
         assertEquals("There should be no in-flight request after close", 0, client.inFlightRequestCount(node.idString()));
         assertFalse(client.hasInFlightRequests(node.idString()));
+        assertFalse(client.hasInFlightRequests());
         assertFalse("Connection should not be ready after close", client.isReady(node, 0));
     }
 
@@ -253,6 +255,7 @@ public class NetworkClientTest {
         client.poll(requestTimeoutMs, now);
         assertEquals(1, client.inFlightRequestCount(node.idString()));
         assertTrue(client.hasInFlightRequests(node.idString()));
+        assertTrue(client.hasInFlightRequests());
 
         selector.close(node.idString());
         List<ClientResponse> responses = client.poll(requestTimeoutMs, time.milliseconds());


Mime
View raw message