test: stabilize gb32960 durable ack boundary
This commit is contained in:
@@ -61,10 +61,9 @@ class Gb32960ChannelHandlerAckBoundaryTest {
|
|||||||
|
|
||||||
dispatch.awaitPublishCount(1);
|
dispatch.awaitPublishCount(1);
|
||||||
dispatch.failDurability();
|
dispatch.failDurability();
|
||||||
channel.runPendingTasks();
|
|
||||||
|
|
||||||
assertThat((Object) channel.readOutbound()).isNull();
|
assertThat((Object) channel.readOutbound()).isNull();
|
||||||
assertThat(channel.isActive()).isFalse();
|
assertThat(awaitInactive(channel)).isTrue();
|
||||||
channel.finishAndReleaseAll();
|
channel.finishAndReleaseAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -151,6 +150,18 @@ class Gb32960ChannelHandlerAckBoundaryTest {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean awaitInactive(EmbeddedChannel channel) {
|
||||||
|
long deadline = System.currentTimeMillis() + 3000;
|
||||||
|
while (System.currentTimeMillis() < deadline) {
|
||||||
|
channel.runPendingTasks();
|
||||||
|
if (!channel.isActive()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Thread.onSpinWait();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private static final class DispatchHarness implements AutoCloseable {
|
private static final class DispatchHarness implements AutoCloseable {
|
||||||
private final ControlledSink sink = new ControlledSink();
|
private final ControlledSink sink = new ControlledSink();
|
||||||
private final DisruptorEventBus eventBus = new DisruptorEventBus(1024, "blocking", List.of(sink));
|
private final DisruptorEventBus eventBus = new DisruptorEventBus(1024, "blocking", List.of(sink));
|
||||||
|
|||||||
Reference in New Issue
Block a user