private void setReadTimeout ( javax . ws . rs . client . Client client ) { // The timeout value. int timeout = mSettings . getReadTimeout ( ) ; synchronized ( mReadTimeoutLock ) { if ( mCurrentReadTimeout == timeout ) { // The given value is the same as the current one. // Let's skip calling property() method. return ; } // The given value is different from the current value. // Let's update the configuration. mCurrentReadTimeout = timeout ; } //---------------------------------------------------------------------- // Note that there was no standardized way to set the read timeout // before JAX-RS API 2.1 (Java EE 8) (cf. ClientBuilder.readTimeout). //---------------------------------------------------------------------- // Convert int to Integer before calling property() method multiple times // in order to reduce the number of object creation by autoboxing. Integer value = Integer . valueOf ( timeout ) ; // For Jersey client . property ( "jersey.config.client.readTimeout" , value ) ; // For Apache CXF client . property ( "http.receive.timeout" , value ) ; // For WebSphere (8.5.5.7+) client . property ( "com.ibm.ws.jaxrs.client.receive.timeout" , value ) ; }
Set a read timeout .