DefaultEventLoopScheduler implements EventLoopScheduler { @VisibleForTesting List<AbstractEventLoopEntry> entries(SessionProtocol sessionProtocol, EndpointGroup endpointGroup, @Nullable Endpoint endpoint) { return state(sessionProtocol, endpointGroup, endpoint).entries(); } DefaultEventLoopScheduler(EventLoopGroup eventLoopGroup, int maxNumEventLoopsPerEndpoint,
                              int maxNumEventLoopsPerHttp1Endpoint,
                              List<ToIntFunction<Endpoint>> maxNumEventLoopsFunctions); @Override ReleasableHolder<EventLoop> acquire(SessionProtocol sessionProtocol,
                                               EndpointGroup endpointGroup,
                                               @Nullable Endpoint endpoint);  }
@Test void stressTest() { final EventLoopGroup group = new DefaultEventLoopGroup(1024); final DefaultEventLoopScheduler s = new DefaultEventLoopScheduler(group, GROUP_SIZE, GROUP_SIZE, ImmutableList.of()); final List<AbstractEventLoopEntry> acquiredEntries = new ArrayList<>(); stressTest(s, acquiredEntries, 0.8); stressTest(s, acquiredEntries, 0.5); stressTest(s, acquiredEntries, 0.2); acquiredEntries.forEach(AbstractEventLoopEntry::release); final List<AbstractEventLoopEntry> entries = s.entries(SessionProtocol.HTTP, endpoint, endpoint); for (AbstractEventLoopEntry e : entries) { assertThat(e.activeRequests()).withFailMessage("All entries must have 0 activeRequests.").isZero(); } assertThat(entries.get(0).id()).isZero(); }