This clearly violates cancel method javadoc "Subsequent calls to isCancelled will always return true if this method returned true" And I believe cancel should've returned false itself since it should "return false if the task could not be cancelled, typically because it has already completed normally"
Also curent implementation gives result true several times under race if actual cancellation is happening. Consider the following JCStress-based test:
This type was mostly for internal use, within the ReactorNettyTcpClient until it was made public recently with #21175. Indeed it should not return a hardcoded "true" value so I'm scheduling this for a change.
Can you clarify how you're using and ran into this? Directly or perhaps indirectly via ReactorNettyTcpClient or an @MessageMapping method returning a Mono?
Note that this class is now in spring-core. It became public only very recently in 5.1 GA, but remained in spring-messaging. We're fixing this in 5.1.1 by putting it where it belongs in org.springframework.util.concurrent.