Retrieve and validate the timeout value from the REST request.
"X_VOLD_REQUEST_TIMEOUT_MS" is the timeout header.

@return true if present, false if missing
978184
protected boolean hasTimeOutHeader() {

        boolean result = false;
        String timeoutValStr = this.request.getHeader(RestMessageHeaders.X_VOLD_REQUEST_TIMEOUT_MS);
        if(timeoutValStr != null) {
            try {
                this.parsedTimeoutInMs = Long.parseLong(timeoutValStr);
                if(this.parsedTimeoutInMs < 0) {
                    RestErrorHandler.writeErrorResponse(messageEvent,
                                                        HttpResponseStatus.BAD_REQUEST,
                                                        "Time out cannot be negative ");

                } else {
                    result = true;
                }
            } catch(NumberFormatException nfe) {
                logger.error("Exception when validating request. Incorrect timeout parameter. Cannot parse this to long: "
                                     + timeoutValStr,
                             nfe);
                RestErrorHandler.writeErrorResponse(this.messageEvent,
                                                    HttpResponseStatus.BAD_REQUEST,
                                                    "Incorrect timeout parameter. Cannot parse this to long: "
                                                            + timeoutValStr);
            }
        } else {
            logger.error("Error when validating request. Missing timeout parameter.");
            RestErrorHandler.writeErrorResponse(this.messageEvent,
                                                HttpResponseStatus.BAD_REQUEST,
                                                "Missing timeout parameter.");
        }
        return result;
    }
1343892
private int getTimeout( final ITransaction transaction, final WebdavRequest req )
    {

        int lockDuration = DEFAULT_TIMEOUT;
        String lockDurationStr = req.getHeader( "Timeout" );

        if ( lockDurationStr == null )
        {
            lockDuration = DEFAULT_TIMEOUT;
        }
        else
        {
            final int commaPos = lockDurationStr.indexOf( ',' );
            // if multiple timeouts, just use the first one
            if ( commaPos != -1 )
            {
                lockDurationStr = lockDurationStr.substring( 0, commaPos );
            }
            if ( lockDurationStr.startsWith( "Second-" ) )
            {
                lockDuration = new Integer( lockDurationStr.substring( 7 ) ).intValue();
            }
            else
            {
                if ( lockDurationStr.equalsIgnoreCase( "infinity" ) )
                {
                    lockDuration = MAX_TIMEOUT;
                }
                else
                {
                    try
                    {
                        lockDuration = new Integer( lockDurationStr ).intValue();
                    }
                    catch ( final NumberFormatException e )
                    {
                        lockDuration = MAX_TIMEOUT;
                    }
                }
            }
            if ( lockDuration <= 0 )
            {
                lockDuration = DEFAULT_TIMEOUT;
            }
            if ( lockDuration > MAX_TIMEOUT )
            {
                lockDuration = MAX_TIMEOUT;
            }
        }
        return lockDuration;
    }
317798
public Integer getTimeout()
   {
      if (childNode.getTextValueForPatternName("timeout") != null && !childNode.getTextValueForPatternName("timeout").equals("null")) {
         return Integer.valueOf(childNode.getTextValueForPatternName("timeout"));
      }
      return null;
   }
650111
public long timeouts() {
        Lock readerLock = context.ctxLock.readLock();
        readerLock.lock();
        try {
            return SSLContext.sessionTimeouts(context.ctx);
        } finally {
            readerLock.unlock();
        }
    }
1311241
public Integer getLoginTimeout()
   {
      if (childNode.getTextValueForPatternName("login-timeout") != null && !childNode.getTextValueForPatternName("login-timeout").equals("null")) {
         return Integer.valueOf(childNode.getTextValueForPatternName("login-timeout"));
      }
      return null;
   }
823506
public boolean requestTime(String host, int timeout) {
        DatagramSocket socket = null;
        try {
            socket = new DatagramSocket();
            socket.setSoTimeout(timeout);
            InetAddress address = InetAddress.getByName(host);
            byte[] buffer = new byte[NTP_PACKET_SIZE];
            DatagramPacket request = new DatagramPacket(buffer, buffer.length, address, NTP_PORT);

            // set mode = 3 (client) and version = 3
            // mode is in low 3 bits of first byte
            // version is in bits 3-5 of first byte
            buffer[0] = NTP_MODE_CLIENT | (NTP_VERSION << 3);

            // get current time and write it to the request packet
            long requestTime = System.currentTimeMillis();
            long requestTicks = SystemClock.elapsedRealtime();
            writeTimeStamp(buffer, TRANSMIT_TIME_OFFSET, requestTime);

            socket.send(request);

            // read the response
            DatagramPacket response = new DatagramPacket(buffer, buffer.length);
            socket.receive(response);
            long responseTicks = SystemClock.elapsedRealtime();
            long responseTime = requestTime + (responseTicks - requestTicks);

            // extract the results
            long originateTime = readTimeStamp(buffer, ORIGINATE_TIME_OFFSET);
            long receiveTime = readTimeStamp(buffer, RECEIVE_TIME_OFFSET);
            long transmitTime = readTimeStamp(buffer, TRANSMIT_TIME_OFFSET);
            long roundTripTime = responseTicks - requestTicks - (transmitTime - receiveTime);
            // receiveTime = originateTime + transit + skew
            // responseTime = transmitTime + transit - skew
            // clockOffset = ((receiveTime - originateTime) + (transmitTime - responseTime))/2
            //             = ((originateTime + transit + skew - originateTime) +
            //                (transmitTime - (transmitTime + transit - skew)))/2
            //             = ((transit + skew) + (transmitTime - transmitTime - transit + skew))/2
            //             = (transit + skew - transit + skew)/2
            //             = (2 * skew)/2 = skew
            mClockOffset = ((receiveTime - originateTime) + (transmitTime - responseTime)) / 2;
            // if (false) Log.d(TAG, "round trip: " + roundTripTime + " ms");
            // if (false) Log.d(TAG, "clock offset: " + clockOffset + " ms");

            // save our results - use the times on this side of the network latency
            // (response rather than request time)
            mNtpTime = responseTime + mClockOffset;
            mNtpTimeReference = responseTicks;
            mRoundTripTime = roundTripTime;
        } catch (Exception e) {
            return false;
        } finally {
            if (socket != null) {
                socket.close();
            }
        }

        return true;
    }
778713
public int getTransactionTimeout() throws XAException {

        final String methodName = "getTransactionTimeout";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, methodName);
        }

        final int timeout = _siXaResource.getTransactionTimeout();

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, methodName, timeout);
        }
        return timeout;

    }
279827
public static boolean areRequestHeadersValid(HeaderMap headers) {
        HeaderValues te = headers.get(Headers.TRANSFER_ENCODING);
        HeaderValues cl = headers.get(Headers.CONTENT_LENGTH);
        if(te != null && cl != null) {
            return false;
        } else if(te != null && te.size() > 1) {
            return false;
        } else if(cl != null && cl.size() > 1) {
            return false;
        }
        return true;
    }
1299929
def is_active(self, timeout=2):
        
        try:
            result = Result(*self.perform_request('HEAD', '/', params={'request_timeout': timeout}))
        except ConnectionError:
            return False
        except TransportError:
            return False

        if result.response.status_code == 200:
            return True

        return False
1052870
private static RequestConfig getRequestConfig(Integer readTimeoutInMillis) {
        return RequestConfig.custom().setConnectionRequestTimeout(600)
                .setConnectTimeout(XianConfig.getIntValue("apache.httpclient.connectTimeout", 600))
                .setSocketTimeout(readTimeoutInMillis).build();
    }
1262344
protected synchronized Response netCall(Request request, int timeout) {
        Response response = null;
        
        if (serverCaps != null && serverCaps.isDebugMode()) {
            timeout = 0;
        }
        
        try {
            socket.setSoTimeout(timeout);
            DataOutputStream requestPacket = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream()));
            request.write(requestPacket, nextSequenceId());
            requestPacket.flush();
            DataInputStream responsePacket = new DataInputStream(new BufferedInputStream(socket.getInputStream()));
            response = new Response(responsePacket);
            
            if (response.getSequenceId() != request.getSequenceId()) {
                throw new IOException("Response is not for current request.");
            }
        } catch (Exception e) {
            netFlush();
            throw MiscUtil.toUnchecked(e);
        }
        
        if (response.getResponseType() == ResponseType.ERROR) {
            throw new RPCException(response.getData());
        }
        
        return response;
    }
273570
private static int getHttpTimeout(Storage st) {
    if (!(st instanceof NNStorage))
      return DFS_IMAGE_TRANSFER_TIMEOUT_DEFAULT; 
    NNStorage storage = (NNStorage) st;
    if (storage == null || storage.getConf() == null) {
      return DFS_IMAGE_TRANSFER_TIMEOUT_DEFAULT;
    }
    return storage.getConf().getInt(DFS_IMAGE_TRANSFER_TIMEOUT_KEY,
        DFS_IMAGE_TRANSFER_TIMEOUT_DEFAULT);
  }
695015
private int initStepTransactionTimeout() {
        logger.entering(sourceClass, "initStepTransactionTimeout");
        Properties p = runtimeStepExecution.getProperties();
        int timeout = DEFAULT_TRAN_TIMEOUT_SECONDS; // default as per spec.
        if (p != null && !p.isEmpty()) {

            String propertyTimeOut = p.getProperty("javax.transaction.global.timeout");
            if (logger.isLoggable(Level.FINE)) {
                logger.log(Level.FINE, "javax.transaction.global.timeout = {0}", propertyTimeOut == null ? "<null>" : propertyTimeOut);
            }
            if (propertyTimeOut != null && !propertyTimeOut.isEmpty()) {
                timeout = Integer.parseInt(propertyTimeOut, 10);
            }
        }
        logger.exiting(sourceClass, "initStepTransactionTimeout", timeout);
        return timeout;
    }
891588
def _did_timeout(self):
        

        bambou_logger.debug('Bambou %s on %s has timeout (timeout=%ss)..' % (self._request.method, self._request.url, self.timeout))
        self._has_timeouted = True

        if self.async:
            self._callback(self)
        else:
            return self
1038556
def timeout(self, value):
        '''
        
        '''
        if not self.params:
            self.params = dict(timeout=value)
            return self
        self.params['timeout'] = value
        return self
321198
public int getConnectionRetryTimeout() {
    int retval;
    if (containsKey(CONNECTION_RETRY_TIMEOUT_MS_PROP)) {
      retval = getInt(CONNECTION_RETRY_TIMEOUT_MS_PROP, CONNECTION_RETRY_TIMEOUT_MS_DEFAULT);
    } else {
      retval = getInt(CLIENT_RETRY_TIMEOUT_MS_PROP, CONNECTION_RETRY_TIMEOUT_MS_DEFAULT);
    }
    Preconditions.checkArgument(retval >= -1, CONNECTION_RETRY_TIMEOUT_MS_PROP + " must be >= -1");
    return retval;
  }
1083161
def get_timeout(service):
    
    custom_timeout_key = "RESTCLIENTS_%s_TIMEOUT" % service.upper()
    if hasattr(settings, custom_timeout_key):
        return getattr(settings, custom_timeout_key)

    default_key = "RESTCLIENTS_DEFAULT_TIMEOUT"
    if hasattr(settings, default_key):
        return getattr(settings, default_key)

    return OLD_DEFAULT_TIMEOUT