You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gary Gregory <ga...@gmail.com> on 2021/02/11 16:31:33 UTC

Java 8 Duration class and timeouts

Hi All,

I've seen instances over time where the scale of timeouts is confusing,
where some timeouts are expressed in milliseconds, others in seconds,
sometimes as an int, sometimes as a long.

I encourage all of us to use the Java 8 class Duration to avoid problems
stemming from this in new APIs. IMO. there is no doubt as to what
Duration.ofSeconds(2) means, as opposed to the literal "2" or "2000" and a
method like "setTimeout()" which does not include a scale name in its name.

I'll be updating VFS to this effect.

Once Net 3.8.0 is out (soon), I would like to make Net 3.9.0 depend on Java
8 and add Duration APIs for its timeouts.

An example of scale mismatch (with distance):
https://solarsystem.nasa.gov/missions/mars-climate-orbiter/in-depth/

Gary