FUTURE add to interface
324298
public ServletConfig createServletConfig(File root, Map<String, Object> attributes, Map<String, String> params) {
	final String servletName = "";
	if (attributes == null) attributes = new HashMap<String, Object>();
	if (params == null) params = new HashMap<String, String>();
	if (root == null) root = new File("."); // working directory that the java command was called from

	final ServletContextImpl servletContext = new ServletContextImpl(root, attributes, params, 1, 0);
	final ServletConfigImpl servletConfig = new ServletConfigImpl(servletContext, servletName);
	return servletConfig;
    }
748905
function() {
		if (!this.resolved) {
			throw new Error('Future must resolve before value is ready');
		} else if (this.error) {
			// Link the stack traces up
			var error = this.error;
			var localStack = {};
			Error.captureStackTrace(localStack, Future.prototype.get);
			var futureStack = Object.getOwnPropertyDescriptor(error, 'futureStack');
			if (!futureStack) {
				futureStack = Object.getOwnPropertyDescriptor(error, 'stack');
				if (futureStack) {
					Object.defineProperty(error, 'futureStack', futureStack);
				}
			}
			if (futureStack && futureStack.get) {
				Object.defineProperty(error, 'stack', {
					get: function() {
						var stack = futureStack.get.apply(error);
						if (stack) {
							stack = stack.split('\n');
							return [stack[0]]
								.concat(localStack.stack.split('\n').slice(1))
								.concat('    - - - - -')
								.concat(stack.slice(1))
								.join('\n');
						} else {
							return localStack.stack;
						}
					},
					set: function(stack) {
						Object.defineProperty(error, 'stack', {
							value: stack,
							configurable: true,
							enumerable: false,
							writable: true,
						});
					},
					configurable: true,
					enumerable: false,
				});
			}
			throw error;
		} else {
			return this.value;
		}
	}
717382
def _add_timeout(self, request, future):
        """"""
        io_loop = IOLoop.current()
        t = io_loop.call_later(
            request.ttl,
            self._request_timed_out,
            request.id,
            request.service,
            request.ttl,
            future,
        )
        io_loop.add_future(future, lambda f: io_loop.remove_timeout(t))
794322
@SuppressWarnings("unchecked")
    <T> ICompletableFuture<Map<Integer, T>> invokeAsync() {
        assert !invoked : "already invoked";
        invoked = true;
        ensureNotCallingFromPartitionOperationThread();
        invokeOnAllPartitions();
        return future;
    }
174753
void addImplementedInterface(final String interfaceName, final Map<String, ClassInfo> classNameToClassInfo) {
        final ClassInfo interfaceClassInfo = getOrCreateClassInfo(interfaceName,
                /* classModifiers = */ Modifier.INTERFACE, classNameToClassInfo);
        interfaceClassInfo.isInterface = true;
        interfaceClassInfo.modifiers |= Modifier.INTERFACE;
        this.addRelatedClass(RelType.IMPLEMENTED_INTERFACES, interfaceClassInfo);
        interfaceClassInfo.addRelatedClass(RelType.CLASSES_IMPLEMENTING, this);
    }
1112878
function future (run) {

  var result,
      resolve_listeners = [],
      reject_listeners = [],
      is_resolving = false,
      is_fullfilled = false,
      is_rejected = false,
      is_uncaught = true

  var promise = {
    then: function (onFulfilled, onRejected) {

      if( onRejected instanceof Function ) is_uncaught = false

      if( is_fullfilled && typeof onFulfilled !== 'function' ) return resolvedFuture(result)

      if( is_rejected && typeof onRejected !== 'function' ) return rejectedFuture(result)

      var _promise = future(function (_resolve, _reject) {

        var _onFulfilled = onFulfilled instanceof Function ? function (_result) {

            // nextTick( _resolveThen(_promise, onFulfilled, _result, _resolve, _reject) );

            nextTick(function () {
              try {
                _resolvePromise(_promise, onFulfilled(_result), _resolve, _reject )
              } catch(_reason) {
                _reject(_reason)
              }

              // _resolvePromise(_promise, { then: function (_complete) {
              //   if( is_completed ) return;
              //   is_completed = true;
              //   // var value = onFulfilled(_result);
              //   // if( value === promise ) console.log('TypeError promise'); // eslint-disable-line
              //   // if( value === _promise ) console.log('TypeError _promise'); // eslint-disable-line
              //   _complete( onFulfilled(_result) );
              // } }, _resolve, _reject );
            })

          } : _resolve

        var _onRejected = onRejected instanceof Function ? function (_result) {

            // nextTick( _resolveThen(_promise, onRejected, _result, _resolve, _reject) );

            nextTick(function () {
              try {
                _resolvePromise(_promise, onRejected(_result), _resolve, _reject )
              } catch(_reason) {
                _reject(_reason)
              }
              // _resolvePromise(_promise, { then: function (_complete) {
              //   if( is_completed ) return;
              //   is_completed = true;
              //   _complete( onRejected(_result) );
              // } }, _resolve, _reject );
            })

          } : _reject

        if( is_fullfilled ) _onFulfilled(result)
        else if( is_rejected ) _onRejected(result)
        else {
          resolve_listeners.push(_onFulfilled)
          reject_listeners.push(_onRejected)
        }

      })

      return _promise
    },
    catch: function (onReject) {
      return promise.then(null, onReject)
    },
  }

  var resolve = function (value) {
    if( is_resolving ) return

    is_resolving = true
    _resolvePromise(promise, value, function (_result) {

      is_fullfilled = true
      result = _result

      nextTick( _runQueue( resolve_listeners, result ) )
      reject_listeners.splice()
    }, reject)
  }

  var reject = function (reason) {
    if( is_resolving || is_fullfilled || is_rejected ) return

    is_resolving = true
    is_rejected = true
    result = reason

    nextTick( _runQueue( reject_listeners, result, is_uncaught ) )
    resolve_listeners.splice()
  }

  try{
    // run.call(promise, resolve, reject);
    run(resolve, reject)
  } catch(_reason) {
    reject(_reason)
  }

  return promise

}
468904
public void addFuture(ListenableFuture<Boolean, OperationCompletionListener> future) {
        future.addListener(this);
        if (future.isDone()) countDown();
        this.futures.add(future);
    }
1354117
public static <A> Will<A> forFuture(Future<A> future) {
        return new Of<A>(JdkFutureAdapters.listenInPoolThread(future));
    }
1328214
public <T> Future<T> submit(Callable<T> callable) {
		checkThreadQueue();
		return threadPool.submit(callable);
	}
647679
public void registerOperation(final ListenableFuture<?> future) {
    count.incrementAndGet();
    Futures.addCallback(future, new FutureCallback<Object>() {
      @Override
      public void onSuccess(Object result) {
        onOperationCompletion();
      }

      @Override
      public void onFailure(Throwable t) {
        onOperationCompletion();
      }
    }, MoreExecutors.directExecutor());
  }
1031186
public AskFuture combine(AskCallback<Object[]> callback, AskFuture... futures) {
        AskFuture future = combine(futures);
        future.addListener(callback);
        return future;
    }
1074715
def sendFuture(self, future):
        """"""
        future = copy.copy(future)
        future.greenlet = None
        future.children = {}

        try:
            if shared.getConst(hash(future.callable), timeout=0):
                # Enforce name reference passing if already shared
                future.callable = SharedElementEncapsulation(hash(future.callable))
            self.socket.send_multipart([
                TASK,
                pickle.dumps(future.id, pickle.HIGHEST_PROTOCOL),
                pickle.dumps(future, pickle.HIGHEST_PROTOCOL),
            ])
        except (pickle.PicklingError, TypeError) as e:
            # If element not picklable, pickle its name
            # TODO: use its fully qualified name
            scoop.logger.warn("Pickling Error: {0}".format(e))
            future.callable = hash(future.callable)
            self.socket.send_multipart([
                TASK,
                pickle.dumps(future.id, pickle.HIGHEST_PROTOCOL),
                pickle.dumps(future, pickle.HIGHEST_PROTOCOL),
            ])
61129
public<T> Future<Void> update(String pathinfo) throws APIException, CadiException {
		final int idx = pathinfo.indexOf('?');
		final String qp; 
		if(idx>=0) {
			qp=pathinfo.substring(idx+1);
			pathinfo=pathinfo.substring(0,idx);
		} else {
			qp=queryParams;
		}

		EClient<CT> client = client();
		client.setMethod(PUT);
		client.addHeader(CONTENT_TYPE, typeString(Void.class));
		client.setQueryParams(qp);
		client.setFragment(fragment);
		client.setPathInfo(pathinfo);
//		client.setPayload(new EClient.Transfer() {
//			@Override
//			public void transfer(OutputStream os) throws IOException, APIException {
//			}
//		});
		client.send();
		queryParams = fragment = null;
		return client.future(null);
	}
148720
public FutureData<PushSubscription> update(String id, PushConnector connector, String name) {
        if (id == null || id.isEmpty() || connector == null) {
            throw new IllegalArgumentException("A push subscription ID and output parameters is required");
        }
        FutureData<PushSubscription> future = new FutureData<>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(UPDATE));
        POST request = config.http()
                .POST(uri, new PageReader(newRequestCallback(future, new PushSubscription(), config)))
                .form("id", id);
        for (Map.Entry<String, String> e : connector.parameters().verifyAndGet().entrySet()) {
            request.form(e.getKey(), e.getValue());
        }
        if (name != null && !name.isEmpty()) {
            request.form("name", name);
        }
        performRequest(future, request);
        return future;
    }
838914
private void connect(int attempt, CompletableFuture<SessionClient> future) {
    if (attempt > MAX_ATTEMPTS) {
      future.completeExceptionally(new PrimitiveException.Unavailable());
      return;
    }

    primaryElection.getTerm().whenCompleteAsync((term, error) -> {
      if (error == null) {
        if (term.primary() == null) {
          future.completeExceptionally(new PrimitiveException.Unavailable());
        } else {
          this.term = term;
          protocol.registerEventListener(sessionId, this::handleEvent, threadContext);
          future.complete(this);
        }
      } else {
        Throwable cause = Throwables.getRootCause(error);
        if (cause instanceof PrimitiveException.Unavailable || cause instanceof TimeoutException) {
          threadContext.schedule(Duration.ofMillis(RETRY_DELAY), () -> connect(attempt + 1, future));
        } else {
          future.completeExceptionally(new PrimitiveException.Unavailable());
        }
      }
    }, threadContext);
  }
871843
public <T> Future<T> submit(Callable<T> callable) {
        return mService.submit(callable);
    }
910135
async def wait_change(self):
        
        future = asyncio.Future(loop=self.loop)
        self._change_futures.add(future)
        future.add_done_callback(self._change_futures.discard)
        await future