loader's delegation chain.
482494
@SuppressWarnings("checkstyle:rightCurly")
  boolean isAncestor(final ClassLoader cl) {
    ClassLoader acl = this;
    do {
      acl = acl.parent;
      if (Objects.equals(cl, acl)) {
        return true;
      }
    } while (acl != null);
    return false;
  }
424255
function chain(stream, state, parser) {
        state.tokenize = parser;
        return parser(stream, state);
    }
1263196
function(app, serverType, handlerMap) {
  let p = pathUtil.getHandlerPath(app.getBase(), serverType);
  if(p) {
    handlerMap[serverType] = Loader.load(p, app);
  }
}
65603
function attach(iLoader $loader, $priority = 0)
    {
        $this->_t_loader_aggregate_getQueue()->insert($loader, $priority);

        $loaderClass = get_class($loader);
        $loaderClass = $this->_normalizeLoaderName($loaderClass);
        $this->_t_loader_aggregate_Names[$loaderClass] = $loader;

        return $this;
    }
407300
function ComponentLoader(load, placeholder, fallback) {
    this.load = load;
    this.placeholder = placeholder;
    this.fallback = fallback;

    this.listeners = [];
}
563690
function(key) {
        if (!this._loader.modules[key])
          return;
        doEnsureEvaluated(this._loader.modules[key], [], this);
        return this._loader.modules[key].module;
      }
422110
def delegate(from_owner, to_owner, methods):
  
  for method in methods:
    _delegate(from_owner, to_owner, method)
656759
private Chain<ApiResponse> createResponseChain(IAsyncHandler<ApiResponse> responseHandler) {
        ResponseChain chain = new ResponseChain(policyImpls, context);
        chain.headHandler(responseHandler);
        chain.policyFailureHandler(result -> {
            if (apiConnectionResponse != null) {
            apiConnectionResponse.abort();
            }
            policyFailureHandler.handle(result);
        });
        chain.policyErrorHandler(result -> {
            if (apiConnectionResponse != null) {
            apiConnectionResponse.abort();
            }
            policyErrorHandler.handle(result);
        });
        return chain;
    }
923759
function(autocrat, governor, origHandler, context) {
    var streamsHash = this.streamsHash,
        handlerSequence, isFirstHandler, deferred, handler;

    context || (context = this.governor);

    if(isFunction(origHandler)) {
      origHandler = bind(origHandler, context);
    } else if(isString(origHandler)){
      origHandler = bind(this.governor[origHandler], context);
    }

    if(autocrat.awaiting[this.streamsHash]) {
      handlerSequence = autocrat.awaiting[this.streamsHash];
    } else {
      handlerSequence = autocrat.awaiting[this.streamsHash] = [];
      isFirstHandler = true;
    }

    deferred = new HandlerDeferred(handlerSequence);
    handler = this._buildAsyncHandler(origHandler, deferred);

    if(isFirstHandler) {
      deferred.handlerIndex = 0;
      handlerSequence.push(handler);
      this.resultStream.subscribe(handler);
    } else {
      deferred.handlerIndex = handlerSequence.length;
      handlerSequence.push(handler);
    }

    // terminate chain
    return this;
  }
230834
public void chainPolicyHandlers() {
        IReadWriteStream<H> previousHandler = null;
        Iterator<PolicyWithConfiguration> iterator = iterator();
        while (iterator.hasNext()) {
            final PolicyWithConfiguration pwc = iterator.next();
            final IPolicy policy = pwc.getPolicy();
            final IReadWriteStream<H> handler = getApiHandler(policy, pwc.getConfiguration());
            if (handler == null) {
                continue;
            }

            if (headPolicyHandler == null) {
                headPolicyHandler = handler;
            }

            if (previousHandler != null) {
                previousHandler.bodyHandler(new IAsyncHandler<IApimanBuffer>() {
                    @Override
                    public void handle(IApimanBuffer result) {
                        handler.write(result);
                    }
                });
                previousHandler.endHandler(new IAsyncHandler<Void>() {
                    @Override
                    public void handle(Void result) {
                        handler.end();
                    }
                });
            }

            previousHandler = handler;
        }

        IReadWriteStream<H> tailPolicyHandler = previousHandler;

        // If no policy handlers were found, then just make ourselves the head,
        // otherwise connect the last policy handler in the chain to ourselves
        // Leave the head and tail policy handlers null - the write() and end() methods
        // will deal with that case.
        if (headPolicyHandler != null && tailPolicyHandler != null) {
            tailPolicyHandler.bodyHandler(new IAsyncHandler<IApimanBuffer>() {

                @Override
                public void handle(IApimanBuffer chunk) {
                    handleBody(chunk);
                }
            });

            tailPolicyHandler.endHandler(new IAsyncHandler<Void>() {

                @Override
                public void handle(Void result) {
                    handleEnd();
                }
            });
        }
    }
779169
def engines(opts, functions, runners, utils, proxy=None):
    '''
    
    '''
    pack = {'__salt__': functions,
            '__runners__': runners,
            '__proxy__': proxy,
            '__utils__': utils}
    return LazyLoader(
        _module_dirs(opts, 'engines'),
        opts,
        tag='engines',
        pack=pack,
    )
804626
def get_delegation_token(self, token_owner, renewer_kerberos_principal_name):
    
    self.send_get_delegation_token(token_owner, renewer_kerberos_principal_name)
    return self.recv_get_delegation_token()
742675
function evaluateLoadedModule(loader, load) {
      console.assert(load.status == 'linked', 'is linked ' + load.name);

      doEnsureEvaluated(load.module, [], loader);
      return load.module.module;
    }
225756
function createLoader(handlers) {
  var handlerMap = new Map(Object.keys(handlers).map(function (key) {
    return [key, handlers[key]];
  }));
  handlers = undefined;

  return function (state, data) {
    var keys = Object.keys(data);
    return Promise.all(keys.map(function (key) {
      var handler = handlerMap.get(key);

      return handler(state, data[key]);
    })).then(function (results) {
      var data = Object.create(null);
      results.forEach(function (result, index) {
        data[keys[index]] = result;
      });
      return data;
    });
  };
}
227452
def _request_loader(self, request: Request) -> Union[User, AnonymousUser]:
        
        header_key = self.token_authentication_header
        args_key = self.token_authentication_key
        token = request.args.get(args_key, request.headers.get(header_key, None))
        if request.is_json:
            data = request.get_json(silent=True) or {}
            token = data.get(args_key, token)

        try:
            data = self.remember_token_serializer.loads(token, max_age=self.token_max_age)
            user = self.user_manager.get(data[0])
            if user and self.security_utils_service.verify_hash(data[1], user.password):
                return user
        except:
            pass

        return self.login_manager.anonymous_user()
1298872
private void doLoadFromPlugin(final String policyImpl, final IAsyncResultHandler<IPolicy> handler) {
        PluginCoordinates coordinates = PluginCoordinates.fromPolicySpec(policyImpl);
        if (coordinates == null) {
            handler.handle(AsyncResultImpl.<IPolicy>create(new PolicyNotFoundException(policyImpl)));
            return;
        }
        int ssidx = policyImpl.indexOf('/');
        if (ssidx == -1) {
            handler.handle(AsyncResultImpl.<IPolicy>create(new PolicyNotFoundException(policyImpl)));
            return;
        }
        final String classname = policyImpl.substring(ssidx + 1);
        this.pluginRegistry.loadPlugin(coordinates, new IAsyncResultHandler<Plugin>() {
            @Override
            public void handle(IAsyncResult<Plugin> result) {
                if (result.isSuccess()) {
                    IPolicy rval;
                    Plugin plugin = result.getResult();
                    PluginClassLoader pluginClassLoader = plugin.getLoader();
                    ClassLoader oldCtxLoader = Thread.currentThread().getContextClassLoader();
                    try {
                        Thread.currentThread().setContextClassLoader(pluginClassLoader);
                        Class<?> c = pluginClassLoader.loadClass(classname);
                        rval = (IPolicy) c.newInstance();
                    } catch (Exception e) {
                        handler.handle(AsyncResultImpl.<IPolicy>create(new PolicyNotFoundException(policyImpl, e)));
                        return;
                    } finally {
                        Thread.currentThread().setContextClassLoader(oldCtxLoader);
                    }

                    policyCache.put(policyImpl, rval);
                    handler.handle(AsyncResultImpl.create(rval));
                } else {
                    handler.handle(AsyncResultImpl.<IPolicy>create(new PolicyNotFoundException(policyImpl, result.getError())));
                }
            }
        });
    }
761919
function delegate(id, method, options) {
  if (typeof openpgp[method] !== 'function') {
    response({ id:id, event:'method-return', err:'Unknown Worker Event' });
    return;
  }
  // construct ReadableStreams from MessagePorts
  openpgp.util.restoreStreams(options);
  // parse cloned packets
  options = openpgp.packet.clone.parseClonedPackets(options, method);
  openpgp[method](options).then(function(data) {
    // clone packets (for web worker structured cloning algorithm)
    response({ id:id, event:'method-return', data:openpgp.packet.clone.clonePackets(data) });
  }).catch(function(e) {
    openpgp.util.print_debug_error(e);
    response({
      id:id, event:'method-return', err:e.message, stack:e.stack
    });
  });
}