Callback registered for the handle with :class:`Router`; appends data
        to the internal queue.
967662
def _on_receive(self, msg):
        
        _vv and IOLOG.debug('%r._on_receive(%r)', self, msg)
        self._latch.put(msg)
        if self.notify:
            self.notify(self)
1154311
def on(self, handler):
        """"""
        if not hasattr(handler, '__call__'):
            raise TypeError('handler is not a callable object.')
        self.handlers.add(handler)
1108088
def insert(index, *args, &block)
      raise_if_locked
      index = assert_index(index)
      handler = self.class::Handler.new(*args, &block)
      @handlers.insert(index, handler)
    end
1022996
function Router(HandleConstructor) {
  if (!(this instanceof Router)) return new Router(HandleConstructor);

  this.Handle = DefaultHandle;
  this.router = new HttpHash();
  this.collections = new Map();
  this.attachMethods = [];
}
856212
def add_callback(self, fn, *args, **kwargs):
        """"""
        if _debug: IOCB._debug("add_callback(%d) %r %r %r", self.ioID, fn, args, kwargs)

        # store it
        self.ioCallback.append((fn, args, kwargs))

        # already complete?
        if self.ioComplete.isSet():
            self.trigger()
839835
function createRoute(result, callback) {
      setTimeout(function throttle() {
        gateway.createRoute({
          ApiId: api.ApiId,
          RouteKey,
          Target: `integrations/${integrationId}`
        }, callback)
      }, 1000)
    }
328938
def handle(self, handler):
        
        with self._hlock:
            self._handler_list.append(handler)
        return self
1154540
function call(handle, route, err, req, res, next) {
  var arity = handle.length;
  var hasError = Boolean(err);

  debug('%s %s : %s', handle.name || '<anonymous>', route, req.originalUrl);

  try {
    if (hasError && arity === 4) {
      // error-handling middleware
      handle(err, req, res, next);
      return;
    } else if (!hasError && arity < 4) {
      // request-handling middleware
      handle(req, res, next);
      return;
    }
  } catch (e) {
    // reset the error
    err = e;
  }

  // continue
  next(err);
}
265385
def handle(self, data):
        
        if self.handler:
            state = self.handler(data)
            if state is None:
                return self.next_state
            return state
        return self.next_state
101018
public function queueRequest($handle, $url, $callback)
    {
        if (!is_resource(self::$queue_handle)) {
            self::initQueue();
        }

        self::$request_queue[] = array(
            'url'       => $url,
            'handle'    => $handle,
            'callback'  => $callback,
            'response'  => '',
        );
        curl_multi_add_handle(self::$queue_handle, $handle);
    }
758372
public synchronized void addHandler(String handlerId) {
		// If it is first async handler subscribed, then create the main buffer
		if (ringBuffer == null) {
			ringBuffer = new Buffer<Object>(capacity);
		}
		/*
		 * Every new Asynchronous handler starts off with all events from EMQ.
		 * So we write all EMQ messages directly to RingBuffer
		 */

		if (earlyMessageQueue != null && earlyMessageQueue.size() != 0) {
			for (Object message : earlyMessageQueue.toArray()) {
				if (message != null) {
					ringBuffer.add(message);
				}
			}
		}

		handlerEventMap.putIfAbsent(handlerId, new HandlerStats(handlerId, sourceId));
		Tr.event(tc, "Added Asynchronous Handler: " + handlerId);
	}
140442
function Router() {
  var self = this;
  this._routes = [];
  this.middleware = function(page, next) {
    self._dispatch(page, next);
  };
}
975940
def add_handler(self, f):
        
        if f.__name__.startswith('rpc_'):
            raise ValueError("Server method names cannot start with rpc_.")
        self._json_rpc_methods[f.__name__] = f
        return f
454606
def add_handler(self, handler):
        """"""
        if not callable(handler):
            raise TypeError("'%s' is not callable." % handler)

        self.append(handler)
623341
def add_done_callback(self, fn):  # pylint: disable=invalid-name
        
        if self._operation.done:
            _try_callback(self, fn)
        else:
            self._queue.put(dill.dumps(fn))
            if self._process is None:
                self._process = mp.Process(target=self._execute_tasks)
                self._process.start()
670123
function(route, name, callback) {
            if (_.isObject(route) && _.isRegExp(route) == false) {
                _.each(route, function(callback, route) {
                    this.route(route, callback, callback);
                }, this);
                return this;
            }

            if (!_.isRegExp(route)) route = Router.routeToRegExp(route);
            logging.log("add route ", name, route);

            History.route(route, _.bind(function(url) {
                var args = Router.extractParameters(route, url);
                logging.log("route callback ", url, name, args);
                callback && callback.apply(this, args);
                this.trigger.apply(this, ['route:' + name].concat(args));
            }, this));

            return this;
        }
281210
def call_handler(self):
        ''''''
        if self.handler is None:
            return
        call = getattr(self.handler, 'call', None)
        if call is not None:
            self.handler_result = call()