kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ij...@apache.org
Subject kafka git commit: KAFKA-4583; Fix KafkaConsumerTest.testGracefulClose transient failure
Date Wed, 04 Jan 2017 11:59:08 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk ac57d1751 -> 7959bf506


KAFKA-4583; Fix KafkaConsumerTest.testGracefulClose transient failure

Author: Rajini Sivaram <rajinisivaram@googlemail.com>

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

Closes #2309 from rajinisivaram/KAFKA-4583


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

Branch: refs/heads/trunk
Commit: 7959bf50696f309c7bf8022461b8cad113ceda8a
Parents: ac57d17
Author: Rajini Sivaram <rajinisivaram@googlemail.com>
Authored: Wed Jan 4 11:58:54 2017 +0000
Committer: Ismael Juma <ismael@juma.me.uk>
Committed: Wed Jan 4 11:58:54 2017 +0000

----------------------------------------------------------------------
 clients/src/test/java/org/apache/kafka/clients/MockClient.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/7959bf50/clients/src/test/java/org/apache/kafka/clients/MockClient.java
----------------------------------------------------------------------
diff --git a/clients/src/test/java/org/apache/kafka/clients/MockClient.java b/clients/src/test/java/org/apache/kafka/clients/MockClient.java
index 9b445c7..ee4b7cc 100644
--- a/clients/src/test/java/org/apache/kafka/clients/MockClient.java
+++ b/clients/src/test/java/org/apache/kafka/clients/MockClient.java
@@ -33,6 +33,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Queue;
 import java.util.Set;
+import java.util.concurrent.ConcurrentLinkedDeque;
 
 /**
  * A mock network client for use testing code
@@ -67,7 +68,8 @@ public class MockClient implements KafkaClient {
     private final Set<String> ready = new HashSet<>();
     private final Map<Node, Long> blackedOut = new HashMap<>();
     private final Queue<ClientRequest> requests = new ArrayDeque<>();
-    private final Queue<ClientResponse> responses = new ArrayDeque<>();
+    // Use concurrent queue for responses so that responses may be updated during poll()
from a different thread.
+    private final Queue<ClientResponse> responses = new ConcurrentLinkedDeque<>();
     private final Queue<FutureResponse> futureResponses = new ArrayDeque<>();
     private final Queue<Cluster> metadataUpdates = new ArrayDeque<>();
 


Mime
View raw message