Requests a timeout event with a specific name and attached data.
436724
protected TimeoutId requestTimeout(final long delay, final TimeUnit unit, @Nullable final String name, @Nullable final Object data) {
        return timeoutManager.requestTimeout(context(), state().getSagaId(), delay, unit, name, data);
    }
1296514
public long getTimeoutMS(String methodName, FacadeOperation op) {
        return getMS(methodName, op, Type.timeout);
    }
814918
function onTimeout() {
    const listenerCount = socket.listeners('timeout').length;
    debug('%s(requests: %s, finished: %s) timeout after %sms, listeners %s',
      socket[SOCKET_NAME], socket[SOCKET_REQUEST_COUNT], socket[SOCKET_REQUEST_FINISHED_COUNT],
      getSocketTimeout(socket), listenerCount);
    agent.timeoutSocketCount++;
    const name = agent.getName(options);
    if (agent.freeSockets[name] && agent.freeSockets[name].indexOf(socket) !== -1) {
      // free socket timeout, destroy quietly
      socket.destroy();
      // Remove it from freeSockets list immediately to prevent new requests
      // from being sent through this socket.
      agent.removeSocket(socket, options);
      debug('%s is free, destroy quietly', socket[SOCKET_NAME]);
    } else {
      // if there is no any request socket timeout handler,
      // agent need to handle socket timeout itself.
      //
      // custom request socket timeout handle logic must follow these rules:
      //  1. Destroy socket first
      //  2. Must emit socket 'agentRemove' event tell agent remove socket
      //     from freeSockets list immediately.
      //     Otherise you may be get 'socket hang up' error when reuse
      //     free socket and timeout happen in the same time.
      if (listenerCount === 1) {
        const error = new Error('Socket timeout');
        error.code = 'ERR_SOCKET_TIMEOUT';
        error.timeout = getSocketTimeout(socket);
        // must manually call socket.end() or socket.destroy() to end the connection.
        // https://nodejs.org/dist/latest-v10.x/docs/api/net.html#net_socket_settimeout_timeout_callback
        socket.destroy(error);
        agent.removeSocket(socket, options);
        debug('%s destroy with timeout error', socket[SOCKET_NAME]);
      }
    }
  }
594867
def await_response_timeout(self):
        """"""
        if _debug: ServerSSM._debug("await_response_timeout")

        abort = self.abort(AbortReason.serverTimeout)
        self.request(abort)
813392
@Override
    protected int getResponseTimeout ( Request req ) {
        if ( req instanceof CommonServerMessageBlockRequest ) {
            Integer overrideTimeout = ( (CommonServerMessageBlockRequest) req ).getOverrideTimeout();
            if ( overrideTimeout != null ) {
                return overrideTimeout;
            }
        }
        return getContext().getConfig().getResponseTimeout();
    }
92099
protected void handleTimeout(REQID rid) {
    if (contextMap.containsKey(rid)) {
      Object ctx = contextMap.get(rid);
      contextMap.remove(rid);
      responseMessageMap.remove(rid);
      onResponse(StatusCode.TIMEOUT_ERROR, ctx, null);
    } else {
      // Since we dont do cancel timer, this is because we already have
      // the response. So just disregard this timeout
      // TODO:- implement cancel timer to avoid this overhead
    }
  }
1047050
def set_timeout(self, timeout, callback):
        """"""
        if not self._ready_sem.acquire(False):
            raise Scapy_Exception("Timer was already started")

        self._callback = callback
        self._timeout = timeout
        self._cancelled.clear()
        self._busy_sem.release()
986094
def _on_request(self, name, args):
        """"""
        if IS_PYTHON3:
            name = decode_if_bytes(name)
        handler = self._request_handlers.get(name, None)
        if not handler:
            msg = self._missing_handler_error(name, 'request')
            error(msg)
            raise ErrorResponse(msg)

        debug('calling request handler for "%s", args: "%s"', name, args)
        rv = handler(*args)
        debug("request handler for '%s %s' returns: %s", name, args, rv)
        return rv
185749
def timeout(seconds, error_message=None):
    """"""

    def decorated(func):
        result = ""

        def _handle_timeout(signum, frame):
            errmsg = error_message or 'Timeout: The action <%s> is timeout!' % func.__name__
            global result
            result = None
            import inspect
            stack_frame = inspect.stack()[4]
            file_name = os.path.basename(stack_frame[1])
            line_no = stack_frame[2]
            method_name = stack_frame[3]
            code_text = ','.join(stack_frame[4])
            stack_info = 'Stack: %s, %s:%s >%s' % (method_name, file_name, line_no, code_text)
            sys.stderr.write(errmsg+'\n')
            sys.stderr.write(stack_info+'\n')
            raise TimeoutError(errmsg)

        @sysx.platform(sysx.UNIX_LIKE, case_false_wraps=func)
        def wrapper(*args, **kwargs):
            global result
            signal.signal(signal.SIGALRM, _handle_timeout)
            signal.alarm(seconds)

            try:
                result = func(*args, **kwargs)
            finally:
                signal.alarm(0)
                return result

        return functools.wraps(func)(wrapper)

    return decorated
888890
def request(self, method, url, **kwargs):
        
        if 'timeout' not in kwargs:
            if self.timeout is not None:
                kwargs['timeout'] = self.timeout
            else:
                kwargs['timeout'] = (DEFAULT_CONNECT_TIMEOUT,
                                     DEFAULT_READ_TIMEOUT)
        return super(Session, self).request(method=method, url=url, **kwargs)
1205446
def _except_if_failed(cls, event):
        """"""
        if event.success is None:
            raise IOTSyncTimeout('Requested timed out', event)
        if not event.success:
            msg = "Request failed, unknown error"
            if isinstance(event.payload, Mapping):
                if P_MESSAGE in event.payload:
                    msg = event.payload[P_MESSAGE]
                try:
                    exc_class = cls.__exception_mapping[event.payload[P_CODE]]
                except KeyError:
                    pass
                else:
                    raise exc_class(msg, event)

            raise IOTException(msg, event)
368927
def timeout(self, timeout):
        """"""
        self._proxy_json._timeout = timeout
        self._proxy_http._timeout = timeout
403574
def timeout(self, value):
        """"""

        if value == TIMEOUT_SESSION:
            self._config.timeout = None
            self._backend_client.expires = None
        else:
            self._config.timeout = value
            self._calculate_expires()
393594
def _timeout(self, timeout, handler, *args, **kw):
        
        t = spawn_thread(target=handler, args=args, kw=kw)
        t.daemon = True
        t.start()
        t.join(timeout)

        if not t.is_alive():
            if t.exc_info:
                return t.exc_info
            return t.result
        else:
            try:
                msg = '[%s] Execution was forcefully terminated'
                raise RuntimeError(msg % t.name)
            except:
                return sys.exc_info()
264186
def _start_timeout():
    """"""
    global _timeout

    LOGGER.debug('Adding a new timeout in %i ms', _timeout_interval)
    _maybe_stop_timeout()
    _timeout = ioloop.IOLoop.current().add_timeout(
        ioloop.IOLoop.current().time() + _timeout_interval / 1000.0,
        _on_timeout)
546742
def _get_slave_timeout(self, dpid, port):
        """"""
        slave = self._get_slave(dpid, port)
        if slave:
            return slave['timeout']
        else:
            return 0
69749
def req(self, timeout):
        ''''''
        self.connection.req(self.id, timeout)
        self.processed = True