Set the result to Future object, wake up all the waiters
        
        :param result: result to set
514215
def set_result(self, result):
        '''
        
        '''
        if hasattr(self, '_result'):
            raise ValueError('Cannot set the result twice')
        self._result = result
        self._scheduler.emergesend(FutureEvent(self, result = result))
914548
def on_success(self, retval, task_id, args, kwargs):
        
        if self.request.is_eager:
            # Store the result because celery wouldn't otherwise
            self.update_state(task_id, SUCCESS, retval)
1246539
def _set_future_result(self):
        """"""
        # This must be done in a lock to prevent the polling thread
        # and main thread from both executing the completion logic
        # at the same time.
        with self._completion_lock:
            # If the operation isn't complete or if the result has already been
            # set, do not call set_result/set_exception again.
            # Note: self._result_set is set to True in set_result and
            # set_exception, in case those methods are invoked directly.
            if self.state != _DONE_STATE or self._result_set:
                return

            if self.error_result is not None:
                exception = _error_result_to_exception(self.error_result)
                self.set_exception(exception)
            else:
                self.set_result(self)
870026
public void setResult(T result) {
        lock.lock();
        try {
            if(Objects.equals(expected_result, result))
                super.setResult(result);
        }
        finally {
            lock.unlock();
        }
    }
1070456
def callback(self, result, message):
        
        self.results.put(result)
        message.ack()
1056361
@Override
	public void set(T result) {
		assert !isComplete();
		this.result = result;
		this.exception = null;
		complete(result);
	}
421862
public void setResult(R result) {
        try {
            lock.lock();
            this.result = result;
            notifyHaveResult();
        }
        finally {
            lock.unlock();
        }
    }
212036
private void throwResult(final Result result) {
		this.executor.execute(new Runnable() {
			
			@Override
			public void run() {
				QConnectorAsyncImpl.this.listener.resultReceived("", result);
			}
		});
	}
98193
def set(self, results):
        
        self.results = list()
        for row in results:
            self.append(row)
747359
def result_worker(ctx, result_cls, get_object=False):
    
    g = ctx.obj
    ResultWorker = load_cls(None, None, result_cls)

    result_worker = ResultWorker(resultdb=g.resultdb, inqueue=g.processor2result)

    g.instances.append(result_worker)
    if g.get('testing_mode') or get_object:
        return result_worker

    result_worker.run()
162076
def _set_closed(self, future):
        
        logger.debug("%s[%s] closed.", self.__class__.__name__, id(self))
        self.on_closed.emit(self)
        self._closed_future.set_result(future.result())
74876
public function setResult($result): self
    {
        $this->_result = $result;
        $this->_hasResult = true;

        return $this;
    }
747817
def write_result(self, result):
        
        assert not self.finished, "Already sent a response"

        if not self.result.thrift_spec:
            self.finished = True
            return

        spec = self.result.thrift_spec[0]
        if result is not None:
            assert spec, "Tried to return a result for a void method."
            setattr(self.result, spec[2], result)

        self.finished = True
955342
public Future<V> submit(Runnable task, V result) {
        if (task == null) throw new NullPointerException();
        NotifyingFuture<V> f = executor.submit(task, result);
        f.setListener(listener);
        return f;
    }
49610
public void onSuccess(T result) {
        try {
            statusLock.lock();
            value = result;
            status = new RequestStatus(RequestStatusCode.OK);
            statusLockChangedCondition.signalAll();
        } catch (Exception e) {
            status = new RequestStatus(RequestStatusCode.ERROR);
            exception = new JoynrRuntimeException(e);
        } finally {
            statusLock.unlock();
        }
    }
600295
def _apply_callback(cls, callback, result):
        
        if not callback.immutable:
            callback.args = (result.id, ) + callback.args
        callback.apply()
397470
public static <T> CompletableFuture<T> completedFuture(T result) {
    CompletableFuture<T> future = new AtomixFuture<>();
    future.complete(result);
    return future;
  }