Add a new server-side Future object to the list to be checked for timeouts
504576
public synchronized void add(RemoteAsyncResultImpl asyncResult) {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();

        ivAllRemoteAsyncResults.add(asyncResult);
        if (asyncResult.ivPmiBean != null) { // d690014.3
            asyncResult.ivPmiBean.asyncFutureObjectIncrement();
        }

        int size = ivAllRemoteAsyncResults.size();

        if (isTraceOn && tc.isDebugEnabled())
            Tr.debug(tc, "add " + asyncResult + "; size=" + size);

        // If this is the only entry in the list, setup the alarm.  d623593
        if (size == 1) {
            ivFuture = ivScheduledExecutor.schedule(this, ivAlarmIntervalMillis, TimeUnit.MILLISECONDS);
        } else if (size >= ivNearMaxResultsThreshold) {
            // d690014.1 - Remove the oldest entry if we have exceeded the maximum
            // number of results.  Otherwise, issue a warning since we are near
            // the maximum.
            boolean warn = false;
            if (size > ivMaxUnclaimedResults) {
                if (!ivWarnedExceededMax) {
                    warn = ivWarnedExceededMax = true;
                }

                Iterator<RemoteAsyncResultImpl> iterator = ivAllRemoteAsyncResults.iterator();
                RemoteAsyncResultImpl oldest = iterator.next();
                releaseResources(oldest); // d690014.3
                iterator.remove();
            } else {
                if (!ivWarnedNearMax) {
                    warn = ivWarnedNearMax = true;
                }
            }

            if (warn) {
                Tr.warning(tc, "MAXIMUM_UNCLAIMED_ASYNC_RESULTS_CNTR0328W",
                           size, ivMaxUnclaimedResults);
            }
        }
    }
1219296
def QA_fetch_future_list_adv(collections=DATABASE.future_list):
    '''
    
    '''
    future_list_items = QA_fetch_future_list()
    if len(future_list_items) == 0:
        print("QA Error QA_fetch_future_list_adv call item for item in collections.find() return 0 item, maybe the DATABASE.future_list is empty!")
        return None
    return future_list_items
1241254
function includeFinished(value) {
            //If a sync build environment, check for errors here, instead of
            //in the then callback below, since some errors, like two IDs pointed
            //to same URL but only one anon ID will leave the loader in an
            //unresolved state since a setTimeout cannot be used to check for
            //timeout.
            var hasError = false;
            if (syncChecks[env.get()]) {
                try {
                    build.checkForErrors(context);
                } catch (e) {
                    hasError = true;
                    deferred.reject(e);
                }
            }

            if (!hasError) {
                deferred.resolve(value);
            }
        }
1220143
function timeoutWith(due, withObservable, scheduler) {
    if (scheduler === void 0) {
        scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_1__["async"];
    }
    return function (source) {
        var absoluteTimeout = Object(_util_isDate__WEBPACK_IMPORTED_MODULE_2__["isDate"])(due);
        var waitFor = absoluteTimeout ? (+due - scheduler.now()) : Math.abs(due);
        return source.lift(new TimeoutWithOperator(waitFor, absoluteTimeout, withObservable, scheduler));
    };
}
261309
OperationFuture<List<Server>> restore(List<Server> serverList, String groupId) {
        List<JobFuture> futures = serverList.stream()
            .map(server ->
                baseServerResponse(
                    client.restore(
                        idByRef(server),
                        new RestoreServerRequest()
                            .targetGroupId(groupId))
                )
                .jobFuture()
            )
            .collect(toList());

        return new OperationFuture<>(
            serverList,
            new ParallelJobsFuture(futures)
        );
    }
1052637
def connect(self, callback=None, timeout=None):
        '''
        
        '''
        if hasattr(self, '_connecting_future') and not self._connecting_future.done():  # pylint: disable=E0203
            future = self._connecting_future  # pylint: disable=E0203
        else:
            if hasattr(self, '_connecting_future'):
                # read previous future result to prevent the "unhandled future exception" error
                self._connecting_future.exception()  # pylint: disable=E0203
            future = tornado.concurrent.Future()
            self._connecting_future = future
            self._connect(timeout=timeout)

        if callback is not None:
            def handle_future(future):
                response = future.result()
                self.io_loop.add_callback(callback, response)
            future.add_done_callback(handle_future)

        return future
1199908
@Override
    public CompletableFuture<Void> add(Operation operation, Duration timeout) {
        ensureRunning();
        return this.operationProcessor.process(operation);
    }
658527
public void addAll(long timestamp, List<T> objectList) {
		for (T object : objectList)
			add(timestamp, object);
	}

	/*
	 * (non-Javadoc)
     *
     * @see kr.jm.utils.collections.JMTimeSeries#toString()
     */
	@Override
	public String toString() {
		return "JMListTimeSeries(intervalSeconds=" + getIntervalSeconds()
				+ ", timeSeriesMap=" + timeSeriesMap.toString() + ")";
	}

}
719801
def submit_future(self, func, *args, **kwargs):
        
        # This mode will run futures synchronously. This should only be used
        # for benchmarking purposes.
        if self.config["sync_http"] is True:
            return MockFuture(func, *args, **kwargs)

        future = self.pool.submit(func, *args, **kwargs)
        self.futures.append(future)
        return future
225408
def add_errback(future, callback, loop=None):
    ''''''
    def _error_back(fut):
        if fut._exception:
            callback(fut.exception())
        elif fut.cancelled():
            callback(CancelledError())

    future = ensure_future(future, loop=None)
    future.add_done_callback(_error_back)
    return future
725653
def append(self, future):
        """"""
        if future._ended() and future.index is None:
            self.inprogress.add(future)
        elif future._ended() and future.index is not None:
            self.ready.append(future)
        elif future.greenlet is not None:
            self.inprogress.add(future)
        else:
            self.movable.append(future)

            # Send the oldest future in the movable deque until under the hwm
            over_hwm = self.timelen(self.movable) > self.highwatermark
            while over_hwm and len(self.movable) > 1:
                sending_future = self.movable.popleft()
                if sending_future.id[0] != scoop.worker:
                    sending_future._delete()
                self.socket.sendFuture(sending_future)
                over_hwm = self.timelen(self.movable) > self.highwatermark
186518
public synchronized void waitForEnd()
	throws ServerException,
	       ClientException,
	       IOException {
        try {
            while(!isDone() && !hasError()) {
                wait();
            }
        } catch(InterruptedException e) {
            // break
        }
	    checkError();
    }
333643
private static <V> ListenableFuture<List<V>> listFuture(
      ImmutableList<ListenableFuture<? extends V>> futures,
      boolean allMustSucceed, Executor listenerExecutor) {
    return new CombinedFuture<V, List<V>>(
        futures, allMustSucceed, listenerExecutor,
        new FutureCombiner<V, List<V>>() {
          @Override
          public List<V> combine(List<Optional<V>> values) {
            List<V> result = Lists.newArrayList();
            for (Optional<V> element : values) {
              result.add(element != null ? element.orNull() : null);
            }
            return Collections.unmodifiableList(result);
          }
        });
  }
27802
def as_completed(objects, count=None, timeout=None):
    
    for obj in objects:
        if not hasattr(obj, 'add_done_callback'):
            raise TypeError('Expecting sequence of waitable objects')
    if count is None:
        count = len(objects)
    if count < 0 or count > len(objects):
        raise ValueError('count must be between 0 and len(objects)')
    if count == 0:
        return
    pending = list(objects)
    for obj in _wait(pending, timeout):
        yield obj
        count -= 1
        if count == 0:
            break
1253145
private void loadLocalityWaits(JSONObject json, Map<ResourceType, Long> 
               newTypeToNodeWait, Map<ResourceType, Long> newTypeToRackWait) 
               throws JSONException {
    Iterator<String> keys = json.keys();
    while (keys.hasNext()) {
      String key = keys.next();
      if (!json.isNull(key)) {
        for (ResourceType type : TYPES) {
          if (key.equals("nodeLocalityWait" + type)) {
            long val = Long.parseLong(json.getString(key));
            newTypeToNodeWait.put(type, val);
          }
          if (key.equals("rackLocalityWait" + type)) {
            long val = Long.parseLong(json.getString(key));
            newTypeToRackWait.put(type, val);
          }
        }
      }
    }
  }
468904
public void addFuture(ListenableFuture<Boolean, OperationCompletionListener> future) {
        future.addListener(this);
        if (future.isDone()) countDown();
        this.futures.add(future);
    }
1249441
def _timeout_future(self, tag, matcher, future):
        '''
        
        '''
        if (tag, matcher) not in self.tag_map:
            return
        if not future.done():
            future.set_exception(TimeoutException())
            self.tag_map[(tag, matcher)].remove(future)
        if not self.tag_map[(tag, matcher)]:
            del self.tag_map[(tag, matcher)]