FUTURE add to interface
432770
public Object getFunctionWithNamedValues(Object coll, Key key, Object[] args, Object defaultValue) {
	return variableUtil.callFunctionWithNamedValues(this, coll, key, args, false, defaultValue);
    }
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());
  }
1196104
def add_interface(self, interface):
        
        if not isinstance(interface, Interface):
            raise TypeError

        self._interfaces[interface.name] = interface
438903
def interface(self, context):
        """"""
        self.context = context
        self.callback = self.context.get("callback")
871843
public <T> Future<T> submit(Callable<T> callable) {
        return mService.submit(callable);
    }
834311
public <T> Future<T> submit(Callable<T> callable) {
        return executorService.submit(callable);
    }
1160602
public void addEvent(E event) {
    CompletableFuture<E> future = futures.poll();
    if (future != null) {
      future.complete(event);
    } else {
      events.add(event);
      if (events.size() > 100) {
        events.remove();
      }
    }
  }
677808
def submit(self, __fun, *args, **kwargs):
    

    future = Future().bind(__fun, *args, **kwargs)
    self.enqueue(future)
    return future
708706
@Override
    public <R, T extends Object> Future<R> callMethodAsync(final String methodName, final T argument) {

        try {
            validateMiddleware();
        } catch (InvalidStateException ex) {
            return FutureProcessor.canceledFuture(ex);
        }

        return GlobalCachedExecutorService.submit(new Callable<R>() {

            private Future<R> internalCallFuture;

            @Override
            public R call() throws Exception {

                final String shortArgument = RPCHelper.argumentToString(argument);

                try {
                    try {
                        logger.debug("Calling method async [" + methodName + "(" + shortArgument + ")] on scope: " + remoteServer.getScope().toString());

                        if (!isConnected()) {
                            try {
                                waitForConnectionState(CONNECTED, CONNECTION_TIMEOUT);
                            } catch (TimeoutException ex) {
                                throw new CouldNotPerformException("Cannot not call async method[" + methodName + "(" + shortArgument + ")] on [" + this + "] in connectionState[" + connectionState + "]", ex);

                            }
                        }
                        final long currentTime = System.nanoTime();
                        remoteServerWatchDog.waitForServiceActivation();
                        internalCallFuture = remoteServer.callAsync(methodName, argument);
                        while (true) {

                            if (TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - currentTime) > RPCHelper.RPC_TIMEOUT) {
                                throw new TimeoutException("RPCMethod call timeout");
                            }

                            try {
                                return internalCallFuture.get(REQUEST_TIMEOUT, TimeUnit.MILLISECONDS);
                            } catch (java.util.concurrent.TimeoutException ex) {


                                // validate connection
                                try {
                                    // if reconnecting do not start a ping but just wait for connecting again
                                    if (getConnectionState() != RECONNECTING) {
                                        ping().get(REQUEST_TIMEOUT, TimeUnit.MILLISECONDS);
                                    } else {
                                        waitForConnectionState(CONNECTING);
                                    }
                                } catch (ExecutionException | java.util.concurrent.TimeoutException | CancellationException exx) {
                                    // cancel call if connection is broken
                                    if (internalCallFuture != null) {
                                        internalCallFuture.cancel(true);
                                    }
                                }
                            } catch (ExecutionException ex) {
                                if (ex.getCause() instanceof RSBException) {
                                    throw new RSBResolvedException("Remote call failed!", (RSBException) ex.getCause());
                                }
                                throw ex;
                            } catch (InterruptedException ex) {
                                Thread.currentThread().interrupt();
                            }

                            // check if thread was interrupted during processing
                            if (Thread.currentThread().isInterrupted()) {
                                throw new InterruptedException();
                            }
                        }


                    } catch (final InterruptedException ex) {
                        if (internalCallFuture != null) {
                            internalCallFuture.cancel(true);
                        }
                        throw ex;
                    } catch (final InvalidStateException ex) {
                        // reinit remote service because middleware connection lost!
                        switch (connectionState) {
                            // only if the connection was established before and no reconnect is ongoing.
                            case CONNECTING:
                            case CONNECTED:
                                try {
                                    reinit();
                                } catch (final CouldNotPerformException exx) {
                                    ExceptionPrinter.printHistory("Recovering middleware connection failed!", exx, logger);
                                }
                        }
                        throw ex;
                    }
                } catch (final CouldNotPerformException | CancellationException | InterruptedException ex) {
                    throw new CouldNotPerformException("Could not call remote Method[" + methodName + "(" + shortArgument + ")] on Scope[" + remoteServer.getScope() + "].", ex);
                }
            }
        });
    }
12589
@Override
    public Future<U> link(U current, BasicProfile to) {
        return toScala(doLink(current, to));
    }
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);
	}
275018
@Override
    public Future<?> submit(Runnable task) {
        if (task == null) {
            throw new NullPointerException();
        }
        RunnableFuture<Object> ftask = newTaskFor(task, null);
        execute(ftask);
        return ftask;
    }
1323580
@SuppressWarnings({ "unchecked", "rawtypes" })
    public void add(Future future) {
        checkAddAllowed();
        checkInEventLoop();
        ++expectedCount;
        future.addListener(listener);
    }
1033517
def sendResult(self, future):
        """"""
        # Greenlets cannot be pickled
        future.greenlet = None
        assert future._ended(), "The results are not valid"
        self.socket.sendResult(future)
1183700
def submit(self, call, *args, **kwargs):
        
        future = StoredFuture(call, *args, **kwargs)
        self._queue.put(future)
        self._ensure_worker()
        return future
874563
def add_callbacks(self, future, callback, errback):
        
        def done(f):
            try:
                res = f.result()
                if callback:
                    callback(res)
            except Exception:
                if errback:
                    errback(create_failure())
        return future.add_done_callback(done)
958118
def future(self):
        
        fut = asyncio.Future()
        self.connect(fut, self.AUTO_FUTURE)
        return fut