Skip to content

Commit

Permalink
Fix ChannelPoolInitTest NullPointerException
Browse files Browse the repository at this point in the history
It seems that there was a race condition where we try to inspect `ChannelSet`
while it is still null and `initialized` property is still false.
This small reordering ensures that `initialize()` method of `ChannelPool` has
been already called, because channelOpened event already fired.
  • Loading branch information
Bouncheck authored and Piotr Grabowski committed May 6, 2024
1 parent 597f0c8 commit 633f76c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ public void should_reconnect_when_init_incomplete() throws Exception {
// A reconnection should have been scheduled
verify(reconnectionSchedule, VERIFY_TIMEOUT).nextDelay();
inOrder.verify(eventBus, VERIFY_TIMEOUT).fire(ChannelEvent.reconnectionStarted(node));
assertThat(pool.channels[0]).containsOnly(channel1);
inOrder.verify(eventBus, VERIFY_TIMEOUT).fire(ChannelEvent.channelOpened(node));
assertThat(pool.channels[0]).containsOnly(channel1);

channel2Future.complete(channel2);
factoryHelper.waitForCalls(node, 1);
Expand Down

0 comments on commit 633f76c

Please sign in to comment.