Calls all the saved callbacks for a specific message ID
@param string mesgId
@param object data
518224
function ParseReply(mesgId, data, sid) {
    var i;

    for(i = 0 ; i < callbackList.length ; i++) {
        if(callbackList[i].id.toString() === mesgId.toString() ) {
            callbackList[i].func(data, sid);
        }
    }
}
601780
public function handler_write($id, $data) {
        if (is_null($this->connection)) {
            // The session has already been closed, don't attempt another write.
            error_log('Tried to write session: '.$id.' before open or after close.');
            return false;
        }

        // We do not do locking here because memcached doesn't.  Also
        // PHP does open, read, destroy, write, close. When a session doesn't exist.
        // There can be race conditions on new sessions racing each other but we can
        // address that in the future.
        try {
            $this->connection->setex($id, $this->timeout, $data);
        } catch (RedisException $e) {
            error_log('Failed talking to redis: '.$e->getMessage());
            return false;
        }
        return true;
    }
1324231
function (aggId, cmd, clb) {
    if (!aggId || !_.isString(aggId)) {
      var err = new Error('Please pass a valid aggregate id!');
      debug(err);
      throw err;
    }
    if (!cmd || !_.isObject(cmd)) {
      var err = new Error('Please pass a valid command!');
      debug(err);
      throw err;
    }
    if (!clb || !_.isFunction(clb)) {
      var err = new Error('Please pass a valid callback!');
      debug(err);
      throw err;
    }

    this.queue[aggId] = this.queue[aggId] || [];
    this.queue[aggId].push({ command: cmd, callback: clb })
  }
888566
protected function callback($args) {
		$checkReg = '/[^a-zA-Z0-9;._-]/';
		$node = (isset($args['node']) && !preg_match($checkReg, $args['node']))? $args['node'] : '';
		$json = (isset($args['json']) && @json_decode($args['json']))? $args['json'] : '{}';
		$bind  = (isset($args['bind']) && !preg_match($checkReg, $args['bind']))? $args['bind'] : '';
		$done = (!empty($args['done']));
		
		while( ob_get_level() ) {
			if (! ob_end_clean()) {
				break;
			}
		}
		
		if ($done || ! $this->callbackWindowURL) {
			$script = '';
			if ($node) {
				$script .= '
					var w = window.opener || weindow.parent || window
					var elf = w.document.getElementById(\''.$node.'\').elfinder;
					if (elf) {
						var data = '.$json.';
						data.warning && elf.error(data.warning);
						data.removed && data.removed.length && elf.remove(data);
						data.added   && data.added.length   && elf.add(data);
						data.changed && data.changed.length && elf.change(data);';
				if ($bind) {
					$script .= '
						elf.trigger(\''.$bind.'\', data);';
				}
				$script .= '
						data.sync && elf.sync();
					}';
			}
			$script .= 'window.close();';
			
			$out = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><script>'.$script.'</script></head><body><a href="#" onlick="window.close();return false;">Close this window</a></body></html>';
			
			header('Content-Type: text/html; charset=utf-8');
			header('Content-Length: '.strlen($out));
			header('Cache-Control: private');
			header('Pragma: no-cache');
			
			echo $out;
			
		} else {
			$url = $this->callbackWindowURL;
			$url .= ((strpos($url, '?') === false)? '?' : '&')
				 . '&node=' . rawurlencode($node)
				 . (($json !== '{}')? ('&json=' . rawurlencode($json)) : '')
				 . ($bind? ('&bind=' .  rawurlencode($bind)) : '')
				 . '&done=1';
			
			header('Location: ' . $url);
			
		}
		exit();
	}
175501
private void addCallback(BeanMessageID type, Callback<?> callback) {
        List<Callback<?>> callbacks = beanCallbacks.get(type);
        if (callbacks == null) {
            callbacks = new ArrayList<>(16);
            beanCallbacks.put(type, callbacks);
        }
        callbacks.add(callback);
    }
1363309
def _do_update_callback(self, msg):
        """"""
        for callback, device in self._update_callbacks:
            if device == msg:
                _LOGGER.debug('Update callback %s for device %s by %s',
                              callback, device, msg)
                self._event_loop.call_soon(callback, msg)
7642
private function _callback()
    {
        phpCAS::traceBegin();
        if (preg_match('/^PGTIOU-[\.\-\w]+$/', $_GET['pgtIou'])) {
            if (preg_match('/^[PT]GT-[\.\-\w]+$/', $_GET['pgtId'])) {
                $this->printHTMLHeader('phpCAS callback');
                $pgt_iou = $_GET['pgtIou'];
                $pgt = $_GET['pgtId'];
                phpCAS::trace('Storing PGT `'.$pgt.'\' (id=`'.$pgt_iou.'\')');
                echo '<p>Storing PGT `'.$pgt.'\' (id=`'.$pgt_iou.'\').</p>';
                $this->_storePGT($pgt, $pgt_iou);
                $this->printHTMLFooter();
                phpCAS::traceExit("Successfull Callback");
            } else {
                phpCAS::error('PGT format invalid' . $_GET['pgtId']);
                phpCAS::traceExit('PGT format invalid' . $_GET['pgtId']);
            }
        } else {
            phpCAS::error('PGTiou format invalid' . $_GET['pgtIou']);
            phpCAS::traceExit('PGTiou format invalid' . $_GET['pgtIou']);
        }

        // Flush the buffer to prevent from sending anything other then a 200
        // Success Status back to the CAS Server. The Exception would normally
        // report as a 500 error.
        flush();
        throw new CAS_GracefullTerminationException();
    }
951638
public static function callback(
        $msg = '',
        $handler = null,
        $default = null,
        $noValidMessage = null,
        $attemptTimes = 3,
        $failCloseMessage = false
    ) {
        $prompter = new CallbackPrompter();

        $prompter->setHandler($handler);

        static::prepareCallbackPrompter($prompter, $noValidMessage, $attemptTimes, $failCloseMessage);

        return $prompter->ask($msg, $default);
    }
1049397
public function setCallback($data = [])
    {
        if (is_array($data)) {

            if (array_key_exists('callbackOnFail', $data)) {
                $this->setSecondaryCallbackURL($data['callbackOnFail']);
            }

            if (array_key_exists('callbackOnSuccess', $data)) {
                $this->setPrimaryCallbackURL($data['callbackOnSuccess']);
            }

            if (array_key_exists('error', $data)) {
                $this->setSecondaryCallbackURL($data['error']);
            }

            if (array_key_exists('success', $data)) {
                $this->setPrimaryCallbackURL($data['success']);
            }

            if (array_key_exists('callback', $data)) {
                $this->setCallback($data['callback']);
            }
        }

        return $this->callback($data);
    }
324131
public void invokeCallbacks(String eventName, T eventData) {
        String name = eventName;
        
        while (!StringUtils.isEmpty(name)) {
            Iterable<IGenericEvent<T>> subscribers = getSubscribers(name);
            
            if (subscribers != null) {
                for (IGenericEvent<T> subscriber : subscribers) {
                    try {
                        if (log.isDebugEnabled()) {
                            log.debug(String.format("Firing local Event[name=%s,data=%s]", eventName, eventData));
                        }
                        subscriber.eventCallback(eventName, eventData);
                    } catch (Throwable e) {
                        log.error("Error during local event callback.", e);
                    }
                }
            }
            
            name = stripLevel(name);
        }
    }
664309
function handleMessage(event) {
  if (!event.data) {
    return;
  }

  switch (event.data) {
    case 'NETWORK_IDLE_ENQUIRY_RESULT_IDLE':
    case 'NETWORK_IDLE_CALLBACK':
      networkIdleCallback.__callbacks__.forEach(callback => {
        networkIdleCallback.__popCallback__(callback, false);
      });
      break;
  }
}
92103
function (when, methodName, record) {
            var callbacks = registry[when][methodName]
            for (var i = 0, l = callbacks.length; i < l; i++) {
                callbacks[i].call(this, record)
            }
        }
341853
function _onMessage(message) {
        var response    = JSON.parse(message.data),
            msgRecord   = _messageCallbacks[response.id],
            callback    = msgRecord && msgRecord.callback,
            msgText     = (msgRecord && msgRecord.message) || "No message";

        if (msgRecord) {
            // Messages with an ID are a response to a command, fire callback
            callback(response.result, response.error);
            delete _messageCallbacks[response.id];
        } else if (response.method) {
            // Messages with a method are an event, trigger event handlers
            var domainAndMethod = response.method.split("."),
                domain = domainAndMethod[0],
                method = domainAndMethod[1];

            EventDispatcher.triggerWithArray(exports[domain], method, response.params);
        }

        // Always fire event handlers for all messages/errors
        exports.trigger("message", response);

        if (response.error) {
            exports.trigger("error", response.error, msgText);
        }
    }
331053
function postMessageToNode(messageId) {
        var msg = {
            fn: messageId,
            args: getFunctionArgs(arguments),
            requester: domainID
        };
        updateDomain.exec('data', msg);
    }
1255159
function _runCallback(eventName, data) {
      for (var id in _mappings[eventName].callbacks) {
        var callbackObject = _mappings[eventName].callbacks[id];

        if (typeof callbackObject.cb === 'function') callbackObject.cb(data);
        if (typeof callbackObject.once === 'boolean' && callbackObject.once === true) _self.off(eventName, callbackObject.cb);
      }
    }
526940
function execute($m, $params=null, $paramtypes=null, $msgID=null)
		{
			if (is_object($m))
			{
				// watch out: if $m is an xmlrpcmsg obj, this will raise a warning: no id memeber...
				$methName = $m->method();
				$msgID = $m->id;
			}
			else
			{
				$methName = $m;
			}
			$sysCall = $this->allow_system_funcs && strpos($methName, "system.") === 0;
			$dmap = $sysCall ? $GLOBALS['_xmlrpcs_dmap'] : $this->dmap;

			if(!isset($dmap[$methName]['function']))
			{
				// No such method
				return new jsonrpcresp(0,
					$GLOBALS['xmlrpcerr']['unknown_method'],
					$GLOBALS['xmlrpcstr']['unknown_method']);
			}

			// Check signature
			if(isset($dmap[$methName]['signature']))
			{
				$sig = $dmap[$methName]['signature'];
				if (is_object($m))
				{
					list($ok, $errstr) = $this->verifySignature($m, $sig);
				}
				else
				{
					list($ok, $errstr) = $this->verifySignature($paramtypes, $sig);
				}
				if(!$ok)
				{
					// Didn't match.
					return new jsonrpcresp(
						0,
						$GLOBALS['xmlrpcerr']['incorrect_params'],
						$GLOBALS['xmlrpcstr']['incorrect_params'] . ": ${errstr}"
					);
				}
			}

			$func = $dmap[$methName]['function'];
			// let the 'class::function' syntax be accepted in dispatch maps
			if(is_string($func) && strpos($func, '::'))
			{
				$func = explode('::', $func);
			}
			// verify that function to be invoked is in fact callable
			if(!is_callable($func))
			{
				error_log("XML-RPC: ".__METHOD__.": function $func registered as method handler is not callable");
				return new jsonrpcresp(
					0,
					$GLOBALS['xmlrpcerr']['server_error'],
					$GLOBALS['xmlrpcstr']['server_error'] . ": no function matches method"
				);
			}

			// If debug level is 3, we should catch all errors generated during
			// processing of user function, and log them as part of response
			if($this->debug > 2)
			{
				$GLOBALS['_xmlrpcs_prev_ehandler'] = set_error_handler('_xmlrpcs_errorHandler');
			}
			try
			{
				if (is_object($m))
				{
					if($sysCall)
					{
						$r = call_user_func($func, $this, $m);
					}
					else
					{
						$r = call_user_func($func, $m);
					}
					if (!is_a($r, 'xmlrpcresp'))
					{
						error_log("XML-RPC: ".__METHOD__.": function $func registered as method handler does not return an xmlrpcresp object");
						if (is_a($r, 'xmlrpcval'))
						{
							$r = new jsonrpcresp($r);
						}
						else
						{
							$r = new jsonrpcresp(
								0,
								$GLOBALS['xmlrpcerr']['server_error'],
								$GLOBALS['xmlrpcstr']['server_error'] . ": function does not return jsonrpcresp or xmlrpcresp object"
							);
						}
					}
				}
				else
				{
					// call a 'plain php' function
					if($sysCall)
					{
						array_unshift($params, $this);
						$r = call_user_func_array($func,$params);
					}
					else
					{
						// 3rd API convention for method-handling functions: EPI-style
						if ($this->functions_parameters_type == 'epivals')
						{
							$r = call_user_func_array($func, array($methName, $params, $this->user_data));
							// mimic EPI behaviour: if we get an array that looks like an error, make it
							// an eror response
							if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r))
							{
								$r = new jsonrpcresp(0, (integer)$r['faultCode'], (string)$r['faultString']);
							}
							else
							{
								// functions using EPI api should NOT return resp objects,
								// so make sure we encode the return type correctly
								$r = new jsonrpcresp(php_xmlrpc_encode($r, array('extension_api')));
							}
						}
						else
						{
							$r = call_user_func_array($func, $params);
						}
					}
					// the return type can be either an xmlrpcresp object or a plain php value...
					if (!is_a($r, 'xmlrpcresp'))
					{
						// what should we assume here about automatic encoding of datetimes
						// and php classes instances???
						$r = new jsonrpcresp(php_jsonrpc_encode($r, $this->phpvals_encoding_options));
					}
				}
				// here $r is either an xmlrpcresp or jsonrpcresp
				if (!is_a($r, 'jsonrpcresp'))
				{

					// dirty trick: user has given us back an xmlrpc response,
					// since he had an existing xmlrpc server with boatloads of code.
					// Be nice to him, and serialize the xmlrpc stuff into JSON.
					// We also override the content_type of the xmlrpc response,
					// but lack knoweledge of intented response charset...
					$r->content_type = 'application/json';
					$r->payload = serialize_jsonrpcresp($r, $msgID);
				}
				else
				{
					$r->id = $msgID;
				}
			}
			catch(Exception $e)
			{
			// (barring errors in the lib) an uncatched exception happened
				// in the called function, we wrap it in a proper error-response
				switch($this->exception_handling)
				{
					case 2:
						throw $e;
						break;
					case 1:
						$r = new jsonrpcresp(0, $e->getCode(), $e->getMessage());
						break;
					default:
						$r = new jsonrpcresp(0, $GLOBALS['xmlrpcerr']['server_error'], $GLOBALS['xmlrpcstr']['server_error']);
				}
			}
			if($this->debug > 2)
			{
				// note: restore the error handler we found before calling the
				// user func, even if it has been changed inside the func itself
				if($GLOBALS['_xmlrpcs_prev_ehandler'])
				{
					set_error_handler($GLOBALS['_xmlrpcs_prev_ehandler']);
				}
				else
				{
					restore_error_handler();
				}
			}
			return $r;
		}
813100
function(messageId, conversationId, callback) {
      if (!messageId) return callback(new Error(utils.i18n.messages.mid));
      messageId = utils.toUUID(messageId);
      if (!conversationId) return callback(new Error(utils.i18n.conversations.id));
      conversationId = utils.toUUID(conversationId);
      utils.debug('Message get: ' + messageId + ', ' + conversationId);
      request.get({
        path: '/conversations/' + conversationId + '/messages/' + messageId
      }, callback);
    }