From 4fd67059bcae058662fbdf2088d3411766c19c60 Mon Sep 17 00:00:00 2001 From: Michael Darakananda Date: Mon, 6 Feb 2017 16:30:39 +1100 Subject: [PATCH] fix race in FakeSubscriberServiceImpl This is the same race as https://github.com/GoogleCloudPlatform/google-cloud-java/pull/1495 but in sendStreamResponse rather than sendError. --- .../google/cloud/pubsub/spi/v1/FakeSubscriberServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/spi/v1/FakeSubscriberServiceImpl.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/spi/v1/FakeSubscriberServiceImpl.java index 29e7f8c3de46..e3098ea2e732 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/spi/v1/FakeSubscriberServiceImpl.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/spi/v1/FakeSubscriberServiceImpl.java @@ -208,6 +208,7 @@ public void sendStreamingResponse(StreamingPullResponse pullResponse) throws InterruptedException { waitForRegistedSubscription(); synchronized (openedStreams) { + waitForOpenedStreams(1); openedStreams.get(getAndAdvanceCurrentStream()).responseObserver.onNext(pullResponse); } }