-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance and rename AsyncEmbeddedEventLoop (#2224)
* Enhance and rename AsyncEmbeddedEventLoop Motivation AsyncEmbeddedEventLoop is an important part of our ongoing testing story for NIO. However, it suffers from two problems. The first is a usability one. As we discovered during the original implementation, following EmbeddedEventLoop's pattern of not having any EventLoop "Tasks" execute until run() meant that simple constructs like `EventLoopFuture.wait` and `EventLoopFuture.get` didn't work at all, forcing us to add an annoying `awaitFuture` method. When playing with implementing EmbeddedChannel, this got worse, as I/O methods also don't run immediately if called from the testing thread. We couldn't easily work around this issue, and it meant that common patterns (like calling `channel.writeAndFlush`) would deadlock! This is unacceptable, so a change had to be made. While we're here, we received feedback that the name is unclear to users. Given that this particular event loop is in no sense "embedded", we no longer need the name, so we can take this opportunity to use a better one. Modifications Changed `func execute` to immediately execute its task body, and to dequeue all pending tasks at this time. Essentially, it's the equivalent to run(). This is a major change in its behaviour. Renamed the loop to `NIOAsyncTestingEventLoop`. Result Better names, easier to use. * Make soundness happy * Remove awaitFuture
- Loading branch information
Showing
4 changed files
with
138 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.