reactor-core
reactor-core copied to clipboard
Fix elapsed time computation in OptimisticEmitFailureHandler
This change addresses the elapsed time computation in OptimisticEmitFailureHandler due to the possibility of a numerical overflow. The described behavior isn't changed from user's perspective.
Javadoc of System.nanoTime() explicitly mentions how to measure elapsed time.
To compare elapsed time against a timeout, use
if (System.nanoTime() - startTime >= timeoutNanos) ...instead ofif (System.nanoTime() >= startTime + timeoutNanos) ...because of the possibility of numerical overflow.