Called when the current pending resource of the specified type has finished
loading. Executes the associated callback (if any) and loads the next
resource in the queue.

@method finish
@param {String} type resource type ('css' or 'js')
@private
764100
function finish(type) {
    var p = pending[type],
        callback,
        urls;

    if (p) {
      callback = p.callback;
      urls     = p.urls;

      urls.shift();
      pollCount = 0;

      // If this is the last of the pending URLs, execute the callback and
      // start the next request in the queue (if any).
      if (!urls.length) {
        callback && callback.call(p.context, p.obj);
        pending[type] = null;
        queue[type].length && load(type);
      }
    }
  }
1018887
function end () {
      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);
      });
    }
1352819
function nextTick() {
        /*jshint validthis:true*/
        var self = this;

        // never resolve when tasks are finished
        if (self.nextTask < self.tasks.length) {
            // if tasks are still queueing
            // increment nextTask
            if (++self.nextTask !== self.tasks.length) return self;
        }

        // check callbacks if all tasks are finished
        resolveCallback.call(self);
        return self;
    }
290663
function fetchResource(t, callback) {
  if (isContinuation(t)) {
    convertContinuation(t, callback);
  } else {
    fetchViaHttp(t, callback);
  }
}
1118868
function flushTypeQueue() {
            forEach(typeQueue, function (type) {
                if (UrlMatcher.prototype.$types[type.name]) {
                    throw new Error("A type named '" + type.name + "' has already been defined.");
                }
                var def = new Type(isInjectable(type.def) ? injector.invoke(type.def) : type.def);
                UrlMatcher.prototype.$types[type.name] = def;
            });
        }
331251
function(type, handler) {
      if (!this.listeners_)
        this.listeners_ = Object.create(null);
      if (!(type in this.listeners_)) {
        this.listeners_[type] = [handler];
      } else {
        var handlers = this.listeners_[type];
        if (handlers.indexOf(handler) < 0)
          handlers.push(handler);
      }
    }
408362
function(type) {
			var result = this.child();
			var me = this.spirit.element;
			if (type) {
				new gui.Crawler().descend(me, {
					handleSpirit: function(spirit) {
						if (spirit instanceof type) {
							if (spirit.element !== me) {
								result = spirit;
								return gui.Crawler.STOP;
							}
						}
					}
				});
			}
			return result;
		}
1103295
function () {
      for (var url in resources) {
        if (pendingRequests[url])
          continue;

        Live.getHead(url, function (url, newInfo) {
          var oldInfo = resources[url],
              hasChanged = false;
          resources[url] = newInfo;
          for (var header in oldInfo) {
            // do verification based on the header type
            var oldValue = oldInfo[header],
                newValue = newInfo[header],
                contentType = newInfo["Content-Type"];
            switch (header.toLowerCase()) {
              case "etag":
                if (!newValue) break;
                // fall through to default
              default:
                hasChanged = oldValue != newValue;
                break;
            }
            // if changed, act
            if (hasChanged) {
              Live.refreshResource(url, contentType);
              break;
            }
          }
        });
      }
    }
1111160
public function run(int $type = WEBHOOK)
    {
        if ($type == WEBHOOK) {
            $this->_is_webhook = true;
            $this->init();
            $this->processWebhookUpdate();
            return;
        }

        if ($type == DEBUG) {
            $this->debug = true;
        }

        $this->init();
        $this->getUpdatesLocal();
    }
466704
function done () {
    that.fetchQueue.stopFetching(key, arguments);
    that.store(key, arguments, callback);
  }
816969
function(type) {
		new edb.Crawler().crawl(type, {
			ontype: function(t) {
				if (!t.$destructed) {
					type.ondestruct();
					type.$ondestruct();
					type.$destructed = true;
					if (!gui.unloading) {
						gui.GreatSpirit.$nukeallofit(type);
					}
				}
			}
		});
	}
473574
function(type, callback, recurse) {
	var evt = localnwt.event;

	for (var i in evt._cached) {
		for(var j=0,numCbs=evt._cached[i].length; j < numCbs; j++) {
			var thisEvt = evt._cached[i][j];
			if (this._node == thisEvt.obj._node && (!type || type == thisEvt.type)) {
				evt.off(thisEvt.obj, thisEvt.type, thisEvt.raw)
			}
		}
	}

	if (recurse) {
		this.all('*').each(function(el){
			el.purge(type, callback, recurse);
		})
	}
}
135692
function(type) {
    this.rules = {};
    this.parseMethods = {};
    this.lastTag;

    var rules = require('./rules/all');
    Object.keys(rules.parseMethods).forEach(function(key) {
        this.parseMethods[key] = typeof rules.parseMethods[key] === 'function' ? rules.parseMethods[key] : this[rules.parseMethods[key]];
    }, this);

    if (type === 'js') {
        rules = require('./rules/javascript');
        this.rules = rules.rules;
    }
    else if (type === 'css' || type === 'less' || type === 'styl' || type === 'scss' || type === 'sass') {
        rules = require('./rules/styles');
        this.rules = rules.rules;
    }
    else {
        rules = null;
    }

    if (rules) {
        Object.keys(rules.parseMethods).forEach(function(key) {
            this.parseMethods[key] = typeof rules.parseMethods[key] === 'function' ? rules.parseMethods[key] : this[rules.parseMethods[key]];
        }, this);
    }
}
438184
protected void incrementRequestCount(ResourceType type, int delta) {
    Context c = getContext(type);
    int newRequestCount = c.requestCount + delta;
    c.requestCount = newRequestCount;
    if (newRequestCount > c.maxConcurrentRequestCount) {
      c.maxConcurrentRequestCount = newRequestCount;
    }
  }
1287274
public void flush() {
        if (annotationsBlocked()) return;
        if (isFlushing()) return;

        startFlushing();
        try {
            while (q.nonEmpty()) {
                q.next().run();
            }
            while (typesQ.nonEmpty()) {
                typesQ.next().run();
            }
            while (afterTypesQ.nonEmpty()) {
                afterTypesQ.next().run();
            }
            while (validateQ.nonEmpty()) {
                validateQ.next().run();
            }
        } finally {
            doneFlushing();
        }
    }
318803
function (types) {

    that.logger.logEnter('callback in loadEventTypes, types:\n' + JSON.stringify(types));

    // The "raw" event type data has a deeply-nested structure and it
    // contains a bunch of stuff we're not interested in.  We'll just
    // store the names of each type's properties.
    Object.keys(types).forEach(function (typeName) {
      if (types[typeName].properties) {
        eventTypes[typeName] = Object.keys(types[typeName].properties);
      }
    });

    that.logger.log('eventTypes:\n' + JSON.stringify(eventTypes));

    if (process.env.TESTONLY_EMIT_INTERNAL_EVENTS) {
      that.emit(that.CONSTANT.internal_event_load_types_done);
    }

    // Now the event buffer can begin processing events.
    eventBuffer.ready();

    that.logger.logExit('callback in loadEventTypes');
  }
433620
@Override
    public synchronized void complete() {
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINEST)) {
            logger.entering(CLASS_NAME, "complete",this);
        }

        if (!lockHeldByDifferentThread())
        {
            //We can't call this or WebContainer won't know to run the complete runnable which kicks off the async listeners
            //        WebContainerRequestState.getInstance(true).setAsyncMode(false);

            if (!completePending){
                //Move this inside of if block because it complete is called
                //after a previous complete, you can get a NPE because the
                //request may have already been cleaned up. If complete is not
                //pending, then it shouldn't have been cleaned up.
                
                if (com.ibm.ws.webcontainer.osgi.WebContainer.getServletContainerSpecLevel() > 31) {
                    //setAsyncStarted(false) upon exit service()
                    WebContainerRequestState reqState = WebContainerRequestState.getInstance(true);
                    reqState.setAttribute("webcontainer.resetAsyncStartedOnExit", "true"); 
                }
                else {
                    iExtendedRequest.setAsyncStarted(false);
                }

                createNewAsyncServletReeentrantLock();

                cancelAsyncTimer();

                completeRunnable = new CompleteRunnable(iExtendedRequest,this);
                completePending = true;
                if (!dispatching){
                    executeNextRunnable();
                }

            }
        } else {
            if (WCCustomProperties.THROW_EXCEPTION_WHEN_UNABLE_TO_COMPLETE_OR_DISPATCH) {
                throw new IllegalStateException(nls.getString("AsyncContext.lock.already.held", "Unable to obtain the lock.  Error processing has already been invoked by another thread."));
            }
        }

        dispatchURI = null;

        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINEST)) {
            logger.exiting(CLASS_NAME, "complete",this);
        }

    }