Iterate through pending context entries, find any entries
that are now satisfied, and move them to the main list.
557661
private synchronized void addedLoginModule() {
        boolean changedEntries = false;

        synchronized (pendingContextEntryRefs) {
            // Check for pending entries that are now satisfied.
            Iterator<ServiceReference<JAASLoginContextEntry>> i = pendingContextEntryRefs.iterator();
            while (i.hasNext()) {
                ServiceReference<JAASLoginContextEntry> contextEntryRef = i.next();
                String[] entryModulePids = (String[]) contextEntryRef.getProperty(JAASLoginContextEntryImpl.CFG_KEY_LOGIN_MODULE_REF);
                if (haveAllModules(entryModulePids)) {
                    i.remove(); // remove from pending list
                    jaasLoginContextEntries.putReference((String) contextEntryRef.getProperty(KEY_ID), contextEntryRef);
                    changedEntries = true;
                }
            }
        }

        if (changedEntries) {
            modified(properties);
        }
    }
1268029
def _process_pending_variables(self):
        
        # Clear our list of pending variables
        self._pending_variables, pending = {}, self._pending_variables
        # Try to apply it. On failure, it will be added again
        for name, data in pending.items():
            self[name] = data
448452
def refresh_if_needed(self):
        
        if self.state in (self.PENDING, self.STARTED):
            try:
                response, = self._fetch_result()['tasks']
            except (KeyError, ValueError):
                raise Exception(
                    "Unable to find results for task."
                )

            if 'error' in response:
                self.state == self.FAILURE
                raise ServerError(response['error'])

            if 'state' in response:
                self.state = response['state']
                self.result = response['result']
880861
def continue_list_folder(cursor)
      resp = request('/files/list_folder/continue', cursor: cursor)
      resp['entries'].map { |e| parse_tagged_response(e) }
    end
293803
def done(self):
        """"""
        if self._finished or self._unfinished:
            return False
        # Clear the 'current' values when iteration is done.
        self.current_index = self.current_future = None
        return True
115677
def update_entries(entries: Entries, data: dict) -> None:
        """"""
        # TODO: Is mutating the list okay, making copies is such a pain in the ass
        for entry in entries:
            entry.update(data)
31292
def _get_pages(self, locations, req):
        """"""
        pending_queue = Queue()
        for location in locations:
            pending_queue.put(location)
        done = []
        seen = set()
        threads = []
        for i in range(min(10, len(locations))):
            t = threading.Thread(target=self._get_queued_page, args=(req, pending_queue, done, seen))
            t.setDaemon(True)
            threads.append(t)
            t.start()
        for t in threads:
            t.join()
        return done
1029188
protected synchronized List<TaskInProgress> findSpeculativeTaskCandidates
    (Collection<TaskInProgress> list) {
    ArrayList<TaskInProgress> candidates = new ArrayList<TaskInProgress>();

    long now = JobTracker.getClock().getTime();
    Iterator<TaskInProgress> iter = list.iterator();
    while (iter.hasNext()) {
      TaskInProgress tip = iter.next();
      if (tip.canBeSpeculated(now)) {
        candidates.add(tip);
      }
    }
    if (candidates.size() > 0 ) {
      Comparator<TaskInProgress> LateComparator =
        new EstimatedTimeLeftComparator(now);

      Collections.sort(candidates, LateComparator);
    }
    return candidates;
  }
276509
def _mark_context_complete(marker, context, has_errors):
    """"""

    current = None

    if marker:
        current = marker.key.get()

    if not current:
        return False

    if current and current.complete:
        return False

    current.complete = True
    current.has_errors = has_errors
    current.put()

    # Kick off completion tasks.
    _insert_post_complete_tasks(context)

    return True
1215781
def list_matching_entries(program, arguments):
    """"""
    output("\n".join(entry.name for entry in program.smart_search(*arguments)))
979177
def iter_context_results(context, batch_size=10, task_cache=None):
    """"""

    for futures in iget_batches(context.task_ids, batch_size=batch_size):
        for key, future in futures:
            task = future.get_result()

            if task_cache is not None:
                task_cache[key.id()] = task

            yield key.id(), task
522107
public List<Long> fetchIncoming() { // TODO: replace with primitive specialization
        if (incoming == null || incoming.isEmpty()) {
            //return EMPTY_LONG_LIST;
            return Collections.emptyList(); // TODO: replace with primitive specialization
        }
        //TLongList result = incoming;
        List<Long> result = incoming;
        this.incoming = null;
        return result;
    }
1012329
def process(self, candidates):
        
        return sorted(candidates, key=attrgetter('score'), reverse=self.reverse)
750982
function(items, iterator, done) {
    done = done || function() {};
    var results = [];
    var failure = false;
    var expected = items.length;
    var current = -1;

    function callback(err, result) {
      if (err) return done(err);

      results.push(result);

      if (current == expected) {
        return done(null, results);
      } else {
        next();
      }
    }

    function next() {
      current += 1;

      var item = items[current];
      iterator(item, callback);
    }

    next()
  }
207411
private void done()
   {
      if (longThreadPool != null && isLong)
      {
         transport.updateLongRunningFree(address,
                                         longThreadPool.getNumberOfFreeThreads() + 1);
      }
      else
      {
         transport.updateShortRunningFree(address,
                                          shortThreadPool.getNumberOfFreeThreads() + 1);
      }
   }
98193
def set(self, results):
        
        self.results = list()
        for row in results:
            self.append(row)
77390
private CompletableFuture<Void> applyInitialize(Indexed<InitializeEntry> entry) {
    for (RaftServiceContext service : raft.getServices()) {
      service.keepAliveSessions(entry.index(), entry.entry().timestamp());
    }
    return CompletableFuture.completedFuture(null);
  }