jdeppe-pivotal commented on a change in pull request #6704:
URL: https://github.com/apache/geode/pull/6704#discussion_r678386363
##########
File path:
geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/pubsub/AbstractPubSubIntegrationTest.java
##########
@@ -715,6 +751,34 @@ public void testPatternWithoutAGlob() {
assertThat(mockSubscriber.getReceivedPMessages()).containsExactly("hello");
}
+ @Test
+ public void concurrentSubscribers_andPublishers_doesNotHang()
+ throws InterruptedException, ExecutionException {
+ AtomicBoolean running = new AtomicBoolean(true);
+
+ Future<Integer> makeSubscribersFuture1 =
+ executor.submit(() -> makeSubscribers(10000, running));
+ Future<Integer> makeSubscribersFuture2 =
+ executor.submit(() -> makeSubscribers(10000, running));
+
+ Future<Integer> publish1 = executor.submit(() -> doPublishing(1, 10000,
running));
+ Future<Integer> publish2 = executor.submit(() -> doPublishing(2, 10000,
running));
+ Future<Integer> publish3 = executor.submit(() -> doPublishing(3, 10000,
running));
+ Future<Integer> publish4 = executor.submit(() -> doPublishing(4, 10000,
running));
+ Future<Integer> publish5 = executor.submit(() -> doPublishing(5, 10000,
running));
+
+ running.set(false);
+
+ assertThat(makeSubscribersFuture1.get()).isGreaterThanOrEqualTo(10);
+ assertThat(makeSubscribersFuture2.get()).isGreaterThanOrEqualTo(10);
Review comment:
The value here is actually a count of messages published so no race
exists since you need to have subscribed before you can receive a published
message. I did adjust the assertion to simply be `> 0` since `10` is somewhat
arbitrary and confusing.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]