Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inline the CompletionStage and JDK Future implementation into Default…
…Promise (#12542) Motivation: If we are going to remove the blocking methods from the Netty Future interface, then converting these futures to JDK futures is going to be a lot more common. The implement these interfaces, we are also going to need access to some underlying blocking primitives, which are exactly the blocking methods that we wish to remove from the public interfaces, and so we'll no longer be able to implement CompletionStage and JDK Future in terms of the Netty Future interface. As it happens, DefaultPromise already always created and cached a DefaultFutureCompletionStage object, so inlining the implementation removes the allocation and object storage overhead. Modification: Move all of the DefaultFutureCompletionStage implementation into DefaultPromise, and adjust the code to avoid the delegation indirection. Result: We can now get CompletionStage and JDK Futures from a Netty Future without any allocation. And even when we don't use those, our Promise and Future implementation is now lighter weight.
- Loading branch information