Dispatch the different steps of sending
176636
def _dispatch_send(self, message):
        

        if self.dryrun:
            return message

        if not self.socket:
            raise GraphiteSendException(
                "Socket was not created before send"
            )

        sending_function = self._send
        if self._autoreconnect:
            sending_function = self._send_and_reconnect

        try:
            if self.asynchronous and gevent:
                gevent.spawn(sending_function, message)
            else:
                sending_function(message)
        except Exception as e:
            self._handle_send_error(e)

        return "sent {0} long message: {1}".format(len(message), message[:75])
988252
def dispatch_in_thread(channel, message)
      callback_id, class_name, method_name, meta_data, *args = message
      method_name = method_name.to_sym

      # Get the class
      klass = Object.send(:const_get, class_name)

      promise = Promise.new
      cookies = nil

      start_time = Time.now.to_f

      # Check that we are calling on a Task class and a method provide at
      # Task or above in the ancestor chain. (so no :send or anything)
      if safe_method?(klass, method_name)
        promise.resolve(nil)

        # Init and send the method
        promise = promise.then do
          result = nil
          Timeout.timeout(klass.__timeout || @worker_timeout) do
            Thread.current['meta'] = meta_data
            begin
              klass_inst = klass.new(@volt_app, channel, self)
              result = klass_inst.send(method_name, *args)
              cookies = klass_inst.fetch_cookies
            ensure
              Thread.current['meta'] = nil
            end
          end

          result
        end

      else
        # Unsafe method
        promise.reject(RuntimeError.new("unsafe method: #{method_name}"))
      end

      # Called after task runs or fails
      finish = proc do |error|
        if error.is_a?(Timeout::Error)
          # re-raise with a message
          error = Timeout::Error.new("Task Timed Out after #{@worker_timeout} seconds: #{message}")
        end

        run_time = ((Time.now.to_f - start_time) * 1000).round(3)
        Volt.logger.log_dispatch(class_name, method_name, run_time, args, error)
      end

      # Run the promise and pass the return value/error back to the client
      promise.then do |result|
        reply = EJSON.stringify(['response', callback_id, result, nil, cookies])
        channel.send_string_message(reply)

        finish.call
      end.fail do |error|
        begin
          finish.call(error)

          begin
            # Try to send, handle error if we can't convert the result to EJSON
            reply = EJSON.stringify(['response', callback_id, nil, error, cookies])

            # use send_string_message, since we stringify here, not on the other
            # side of Drb.
            channel.send_string_message(reply)
          rescue EJSON::NonEjsonType => e
            # Convert the error into a string so it can be serialized to
            # something.
            error = "#{error.class.to_s}: #{error.to_s}"
            channel.send_message('response', callback_id, nil, error, cookies)
          end

        rescue => e
          Volt.logger.error "Error in fail dispatch: #{e.inspect}"
          Volt.logger.error(e.backtrace.join("\n")) if e.respond_to?(:backtrace)
          raise
        end
      end

    end
1033830
def dispatch(self):
    """"""
    try:
      webapp2.RequestHandler.dispatch(self)
    finally:
      self.session_store.save_sessions(self.response)
811324
def send(self, *sender, **kwargs):
        
        if len(sender) == 0:
            sender = None
        elif len(sender) > 1:
            raise TypeError('send() accepts only one positional argument, '
                            '%s given' % len(sender))
        else:
            sender = sender[0]

        if not self.receivers:
            return []

        rv = list()
        for receiver in self.receivers_for(sender):
            try:
                rv.append((receiver, receiver(sender, **kwargs)))
            except Exception:
                logger.exception('Error while dispatching signal "{}" '
                                 'to receiver'.format(self.name))
        return rv
1247733
def notify(self, msgtype, method, params):
        """"""
        self.dispatch.call(method, params)
190168
protected function dispatch()
    {
        // Start processing the requests.
        list($mrc, $active) = $this->process();

        // Keep processing requests until we're done.
        while ($active and $mrc === CURLM_OK) {
            // Process the next request.
            list($mrc, $active) = $this->process();
        }

        // Throw an exception if something went wrong.
        if ($mrc !== CURLM_OK) {
            throw new CurlErrorException('cURL read error #'.$mrc);
        }
    }
474605
def dispatch(message, channel)
      if channel =~ /\Aslanger:/
        # Messages received from the Redis channel slanger:*  carry info on
        # subscriptions. Update our subscribers accordingly.
        update_subscribers message
      else
        push Oj.dump(message, mode: :compat)
      end
    end
58550
function send () {
      sent = true;
      // next tick it to avoid express catching runtime error in the callback
      //   getting caught by express and triggering app's error handler
      process.nextTick(function () {
        res.emit('finish');
        cb(null, res, body);
      });
    }
1172036
<L, E extends Input.Impl> void dispatch(
      Class<L> listenerType, E event, Interaction<L, E> interaction, Interaction<L, E> onCancel) {
    dispatch(event.captureState.layer, listenerType, event, interaction, onCancel);
  }
184741
public function dispatch()
  {
    $moduleName = $this->app->getModuleName();
    $actionName = $this->app->getActionName();
    $layoutFile = $moduleName . ($actionName != "index" ? "_" . $actionName : "") . ".tpl.php";

    $this->tpl->render($layoutFile);
  }
1003421
def dispatch_hook(key, hooks, hook_data):
    """"""

    hooks = hooks or dict()

    if key in hooks:
        try:
            return hooks.get(key).__call__(hook_data) or hook_data

        except Exception, why:
            warnings.warn(str(why))

    return hook_data
589890
def dispatch(request)
      request.each_network do |network, channels|
        connection = connection_to(network)
        next if connection.nil?

        channels.each do |channel|
          message = request.to_message_for channel
          connection.enqueue message
        end
      end
    end
988895
def dispatch(match)
      @_dispatched = true
      target = match.mapping[:target]
      response.merge! begin
        if Proc === target
          instance_exec(&target)
        else
          target.call(env.merge(
            'SCRIPT_NAME' => request.matched_path.chomp('/'),
            'PATH_INFO' => request.unmatched_path[match.path.chomp('/').length..-1]
          ))
        end
      end
    end
1134575
def dispatch(self):
        ''
        import flask
        body = flask.request.get_json()
        return self. dispatch_with_args(body, argMap=dict())
978817
def dispatch(self):
        
        from flask import request

        method = request.method

        data = request.args
        if method == 'POST':
            data = request.form

        token = data.get('token')
        team_id = data.get('team_id')
        command = data.get('command') or data.get('trigger_word')

        if isinstance(command, string_types):
            command = command.strip().lstrip('/')

        try:
            self.validate(command, token, team_id, method)
        except SlackError as e:
            return self.response(e.msg)

        func, _, _, kwargs = self._commands[(team_id, command)]
        kwargs.update(data.to_dict())

        return func(**kwargs)
925284
def dispatch(self, event):
        

        for event_types, queues in self.queues.items():
            if event.type & event_types:
                for queue in queues:
                    queue.put(event)
482970
def dispatch(self, *args, **kwargs):
        """"""
        action = kwargs.pop('action', 'default')
        action_method = getattr(self, str(action), self.default)
        return action_method(*args, **kwargs)