netty5/common/src/test/java/io/netty/util
Chris Vest 7971a252a5
Clean up Future/Promises API (#11575)
Motivation:
The generics for the existing futures, promises, and listeners are too complicated.
This complication comes from the existence of `ChannelPromise` and `ChannelFuture`, which forces listeners to care about the particular _type_ of future being listened on.

Modification:
* Add a `FutureContextListener` which can take a context object as an additional argument. This allows our listeners to have the channel piped through to them, so they don't need to rely on the `ChannelFuture.channel()` method.
* Make the `FutureListener`, along with the `FutureContextListener` sibling, the default listener API, retiring the `GenericFutureListener` since we no longer need to abstract over the type of the future.
* Change all uses of `ChannelPromise` to `Promise<Void>`.
* Change all uses of `ChannelFuture` to `Future<Void>`.
* Change all uses of `GenericFutureListener` to either `FutureListener` or `FutureContextListener` as needed.
* Remove `ChannelFutureListener` and `GenericFutureListener`.
* Introduce a `ChannelFutureListeners` enum to house the constants that previously lived in `ChannelFutureListener`. These constants now implement `FutureContextListener` and take the `Channel` as a context.
* Remove `ChannelPromise` and `ChannelFuture` — all usages now rely on the plain `Future` and `Promise` APIs.
* Add static factory methods to `DefaultPromise` that allow us to create promises that are initialised as successful or failed.
* Remove `CompleteFuture`, `SucceededFuture`, `FailedFuture`, `CompleteChannelFuture`, `SucceededChannelFuture`, and `FailedChannelFuture`.
* Remove `ChannelPromiseNotifier`.

Result:
Cleaner generics and more straight forward code.
2021-08-20 09:55:16 +02:00
..
concurrent Clean up Future/Promises API (#11575) 2021-08-20 09:55:16 +02:00
internal Inline variables to make code more readable (#11565) 2021-08-11 17:07:32 +02:00
AbstractReferenceCountedTest.java Migrate common tests to JUnit 5 (#11319) 2021-05-27 08:31:53 +02:00
AsciiStringCharacterTest.java Migrate common tests to JUnit 5 (#11319) 2021-05-27 08:31:53 +02:00
AsciiStringMemoryTest.java Make variables final (#11548) 2021-08-06 09:28:12 +02:00
AttributeKeyTest.java Migrate common tests to JUnit 5 (#11319) 2021-05-27 08:31:53 +02:00
ConstantPoolTest.java Migrate common tests to JUnit 5 (#11319) 2021-05-27 08:31:53 +02:00
DefaultAttributeMapTest.java Migrate common tests to JUnit 5 (#11319) 2021-05-27 08:31:53 +02:00
DomainNameMappingTest.java Migrate common tests to JUnit 5 (#11319) 2021-05-27 08:31:53 +02:00
DomainWildcardMappingBuilderTest.java Remove Unused Imports (#11546) 2021-08-05 14:08:07 +02:00
HashedWheelTimerTest.java Migrate common tests to JUnit 5 (#11319) 2021-05-27 08:31:53 +02:00
NettyRuntimeTests.java Migrate common tests to JUnit 5 (#11319) 2021-05-27 08:31:53 +02:00
NetUtilTest.java Migrate common tests to JUnit 5 (#11319) 2021-05-27 08:31:53 +02:00
RecyclerTest.java Recycler.WeakOrderQueue drop Object hasBeenRecycled (#11402) 2021-06-23 11:33:16 +02:00
ResourceLeakDetectorTest.java Remove deprecated stuff around ResourceLeakDetector (#11572) 2021-08-11 21:41:49 +02:00