Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Time unit used in Apache CXF methods

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

like image 599
Alexis Dufrenoy Avatar asked Sep 04 '12 08:09

Alexis Dufrenoy


3 Answers

As I know all web services timeouts is configured in milliseconds, I did not see anywhere that the timeout would be configured in seconds. In your case there is a documentation from XSD of:

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

ConnectionTimeout: Specifies the amount of time, in milliseconds, that the consumer will attempt to establish a connection before it times out. 0 is infinite.

This refers here.

like image 190
Paulius Matulionis Avatar answered Oct 05 '22 23:10

Paulius Matulionis


Ok, I finally found it. These methods take values in milliseconds. I found the answer here:

http://lhein.blogspot.fr/2008/09/apache-cxf-and-time-outs.html?showComment=1328760737362#c5269809084998987761

like image 39
Alexis Dufrenoy Avatar answered Oct 05 '22 23:10

Alexis Dufrenoy


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

The method setConnectionTimeout should have been named setConnectionTimeoutMillis and the JavaDoc should have mentioned this somewhere. Developers should do this whenever a unit is involved.

Maybe Java should have had some kind of typed number like Long<MilliSeconds> and numbers of the wrong 'unit' would be refused by the compiler :)

like image 21
Christophe Roussy Avatar answered Oct 05 '22 22:10

Christophe Roussy