Unit of time used in Apache CXF methods

In Apache CXF methods HTTPClientPolicy.setConnectionTimeout()and HTTPClientPolicy.setReceiveTimeout()parameters are specified in seconds or milliseconds? This seems trivial, but I can't find the answer anywhere to start with javadoc ...

+5
source share
3 answers

As I know, all web service timeouts are configured in milliseconds, I have not seen anywhere that the timeout will be configured in seconds. In your case there is documentation from XSDof:

{http://cxf.apache.org/transports/http/configuration}HTTPClientPolicy

ConnectionTimeout:Defines the time, in milliseconds, that the consumer will try to establish a connection before the time has elapsed. 0 endlessly.

It means here .

+5
source

The only hint that it uses long, which in Java is usually in milliseconds, but obviously the block is not documented anywhere.

The method setConnectionTimeoutshould have been named setConnectionTimeoutMillis, and JavaDoc should have mentioned it somewhere. Developers should do this whenever unit is involved .

Maybe Java should have had some kind of typed number, for example Long<MilliSeconds>, and the numbers of the wrong "block" would be rejected by the compiler :)

+1
source

All Articles