Override of ThreadingMixIn.process_request_thread() that delegates to the request handler.
775860
def process_request_thread(self, request, client_address):
    """"""
    # Instantiate the request handler.
    handler = self.RequestHandlerClass(request, client_address, self)
    try:
      # Attempt to handle a request with the handler.
      handler.handle_request()
      self.request_complete_callback()

    except Exception as e:
      # If that fails, (synchronously) handle the error with the error handler sans-fork.
      try:
        handler.handle_error(e)
      finally:
        # Shutdown the socket since we don't expect a fork() in the exception context.
        self.shutdown_request(request)
    else:
      # At this point, we expect a fork() has taken place - the parent side will return, and so we
      # close the request here from the parent without explicitly shutting down the socket. The
      # child half of this will perform an os._exit() before it gets to this point and is also
      # responsible for shutdown and closing of the socket when its execution is complete.
      self.close_request(request)
163549
def _start_handler_thread(self):
        """"""
        # Create handler thread
        t = Thread(target=self._start_loop)
        t.daemon = True

        # Start handler thread
        t.start()
        self.thread_started = True
2411
def prepare(self, context):
		""""""
		if __debug__:
			log.debug("Assigning thread local request context.")
		
		self.local.context = context
1321969
def process_request(self, request):
        
        super(SubdomainURLRoutingMiddleware, self).process_request(request)

        subdomain = getattr(request, 'subdomain', UNSET)

        if subdomain is not UNSET:
            urlconf = settings.SUBDOMAIN_URLCONFS.get(subdomain)
            if urlconf is not None:
                logger.debug("Using urlconf %s for subdomain: %s",
                    repr(urlconf), repr(subdomain))
                request.urlconf = urlconf
1315195
def process_request(self, request, client_address):
        
        if request is None or client_address is None:
            # request was never initialized, i.e. due to overload
            return 

        t = threading.Thread(target = self.process_request_thread,
                             args = (request, client_address))

        t.daemon = False

        with self._thread_guard:
            if self._close:
                # server is done. do not make more threads
                self.shutdown_request(request)
                return 

            if self._threads is None:
                self._threads = {}

            if len(self._threads) + 1 > MAX_RPC_THREADS:
                # overloaded
                log.warning("Too many outstanding requests ({})".format(len(self._threads)))
                self.shutdown_request(request)
                return

            t.start()

            self._threads[t.ident] = t

            if BLOCKSTACK_TEST:
                log.debug('{} active threads (added {})'.format(len(self._threads), t.ident))
623918
def get_request(self):
        
        # Note that this class must be mixed with another class that implements get_request()
        request, client_addr = super(BoundedThreadingMixIn, self).get_request()
        overload = False
        with self._thread_guard:
            if self._threads is not None and len(self._threads) + 1 > MAX_RPC_THREADS:
                overload = True

        if overload:
            res = self.overloaded(client_addr)
            request.sendall(res)

            sys.stderr.write('{} - - [{}] "Overloaded"\n'.format(client_addr[0], time_str(time.time())))
            self.shutdown_request(request)
            return None, None

        return request, client_addr
867545
def callToThread(method):
    
    def func_wrapped(self, *args, **kwargs):
      self.thread.execute_queue.put_nowait((threading.get_ident(), method, args, kwargs))
      return self.waitResult()
    return func_wrapped
600901
def process_request(self):
        """"""
        self.response = self.request_handler.process_request(
            self.method, self.request_data)
1306021
def on_threads_request(self, py_db, request):
        '''
        
        '''
        return self.api.list_threads(py_db, request.seq)
875125
def post(self, request, *args, **kwargs):
        
        return self.lock(request, *args, **kwargs)
79459
def process(self):
        
        assert self.queue is not None
        while True:
            event = self.queue.get()
            if self.pre_process_event(event):
                self.invoke_handlers(event)
            self.queue.task_done()
159304
public void processRequest(RequestEvent req) {
		
		if (tracer.isInfoEnabled()) {
			tracer.info("Received Request:\n"+req.getRequest());
		}

		// Restcomm Statistics
		final String method = req.getRequest().getMethod();
		if (Request.INVITE.equalsIgnoreCase(method)) {
			this.defaultUsageParameters.incrementCalls(1);
		}
		if (Request.MESSAGE.equalsIgnoreCase(method)) {
			this.defaultUsageParameters.incrementMessages(1);
		}

		// get dialog wrapper
		final Dialog d = req.getDialog();
		final DialogWrapper dw = getDialogWrapper(d);
		if (dw != null && req.getServerTransaction() == null) {
			if (tracer.isInfoEnabled()) {
				tracer.info("No server tx found, for in dialog request, assuming it as retransmission and dropping...");
			}
			return;
		}
		
		if (req.getRequest().getMethod().equals(Request.CANCEL)) {
			processCancelRequest(req,dw);
		} else {
			processNotCancelRequest(req,dw);
		}
	}
1263782
protected function perform()
    {
        if (!$this->requests) {
            return;
        }

        // Initialize the handles with a very quick select timeout
        $active = $mrc = null;
        $this->executeHandles($active, $mrc, 0.001);
        $event = new Event(array('curl_multi' => $this));
        $this->processMessages();

        while ($this->requests) {

            // Notify each request as polling
            $blocking = $total = 0;
            foreach ($this->requests as $request) {
                ++$total;
                $event['request'] = $request;
                $request->getEventDispatcher()->dispatch(self::POLLING_REQUEST, $event);
                // The blocking variable just has to be non-falsey to block the loop
                if ($request->getParams()->hasKey(self::BLOCKING)) {
                    ++$blocking;
                }
            }

            if ($blocking == $total) {
                // Sleep to prevent eating CPU because no requests are actually pending a select call
                usleep(500);
            } else {
                do {
                    $this->executeHandles($active, $mrc, 1);
                } while ($active);
            }
            $this->processMessages();
        }
    }
1036044
void handleRequest(ByteBuf buffer) {
    long requestId = buffer.readLong();

    try {
      Object request = readRequest(buffer);
      HandlerHolder handler = handlers.get(request.getClass());
      if (handler != null) {
        handler.context.executor().execute(() -> handleRequest(requestId, request, handler));
      } else {
        handleRequestFailure(requestId, new SerializationException("unknown message type: " + request.getClass()), this.context);
      }
    } catch (SerializationException e) {
      handleRequestFailure(requestId, e, this.context);
    } finally {
      buffer.release();
    }
  }
1061125
def _create_process_thread(self):
        
        thread = threading.Thread(target=self._process_data_events)
        thread.setDaemon(True)
        thread.start()
319056
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
	{
		$requestMethod = $request->getMethod();
		$method = $this->getOverrideMethod($requestMethod, $request);

		if (!empty($method) && $method !== $requestMethod) {
			$allowed = $this->getAllowedOverrideMethods($requestMethod);
			if ([] !== $allowed) {
				if (\in_array($method, $allowed, true)) {
					$request = $request->withMethod($method);
				} else {
					return Factory::response(405);
				}
			}
		}

		return $handler->handle($request);
	}
437508
def request(self, *args, **kwargs):
        
        func = partial(super().request, *args, **kwargs)
        return self.loop.run_in_executor(self.thread_pool, func)