Dispatches success to all of the callbacks registered with this list. This may only be called
once.

@throws IllegalStateException if this callback has already fired.
196400
@Override
  public void onSuccess(T result) {
    checkState();
    for (Callback<T> cb : callbacks) {
      cb.onSuccess(result);
    }
    callbacks = null; // note that we've fired
  }
739730
public void finallyDo(Callback resultCB) {
        // FIXME: this can be implemented more efficient
        while( !lock.compareAndSet(false,true) ) {}
        try {
            if (resultReceiver != null)
                throw new RuntimeException("Double register of future listener");
            resultReceiver = resultCB;
            if (hadResult) {
                hasFired = true;
                lock.set(false);
                resultCB.complete(result, error);
            }
        } finally {
            lock.set(false);
        }
    }
607280
@Override
    public void succeeded() {
        boolean process = false;
        try (Locker.Lock lock = _locker.lock()) {
            switch (_state) {
                case PROCESSING: {
                    _state = State.CALLED;
                    break;
                }
                case PENDING: {
                    _state = State.PROCESSING;
                    process = true;
                    break;
                }
                case CLOSED:
                case FAILED: {
                    // Too late!
                    break;
                }
                default: {
                    throw new IllegalStateException(toString());
                }
            }
        }
        if (process)
            processing();
    }
706134
public void complete() {
        long seqNo = this.operation.getSequenceNumber();
        Preconditions.checkState(seqNo >= 0, "About to complete a CompletableOperation that has no sequence number.");

        this.done = true;
        if (this.successHandler != null) {
            Callbacks.invokeSafely(this.successHandler, null, cex -> log.error("Success Callback invocation failure.", cex));
        }
    }
1228109
function (callbackId, isSuccess, status, args, keepCallback) {
        try {
            var callback = cordova.callbacks[callbackId];
            if (callback) {
                if (isSuccess && status === cordova.callbackStatus.OK) {
                    callback.success && callback.success.apply(null, args);
                } else if (!isSuccess) {
                    callback.fail && callback.fail.apply(null, args);
                }
                /*
                else
                    Note, this case is intentionally not caught.
                    this can happen if isSuccess is true, but callbackStatus is NO_RESULT
                    which is used to remove a callback from the list without calling the callbacks
                    typically keepCallback is false in this case
                */
                // Clear callback if not expecting any more results
                if (!keepCallback) {
                    delete cordova.callbacks[callbackId];
                }
            }
        } catch (err) {
            var msg = 'Error in ' + (isSuccess ? 'Success' : 'Error') + ' callbackId: ' + callbackId + ' : ' + err;
            console && console.log && console.log(msg);
            console && console.log && err.stack && console.log(err.stack);
            cordova.fireWindowEvent('cordovacallbackerror', { 'message': msg });
            throw err;
        }
    }
365964
public void sync() {
		if (!validState) {
			throw new InvalidStateException();
		}
		if (useMmap) {
			syncAllMmaps();
		}
		if (fileChannel != null) {
			try {
				fileChannel.force(false);
			} catch (Exception ign) {
			}
		}
		if (callback != null) {
			callback.synched();
		}
	}
1011519
public void commit() {
		for (Iterator i = listeners.iterator(); i.hasNext();) {
			((CommitTriggerListener) i.next()).commit();
		}
	}
115778
public function success()
    {
        if (!$this->isClosed()) {
            $this->fireEvent(self::OPEN, self::CLOSED);
        }

        $this->failures = [];
        return $this->write();
    }
546835
@Override
    public void close(FutureCallback<Void> callback) throws IllegalStateException {
        assertOpen();

        Future<?> future = this.eventGroup.shutdownGracefully(0L, 5L, TimeUnit.SECONDS);
        future.addListener(new NetworkManagerVoidFutureCallback(callback));
    }
1283531
private void checkState() {
        if (startWith == null && lastResult == null) {
            final String msg = "Please call startWith(uri) first.";
            LOG.error(msg);
            throw new IllegalStateException(msg);
        }
    }
126382
@Override
    public void rollback() throws IllegalStateException, SystemException
    {
        for (ResourceManager implementor : implementors)
        {
            if (implementor != null)
            {
                implementor.doRollback();
                status = Status.STATUS_ROLLEDBACK;
            }
        }
    }
1237958
public synchronized void finished()
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "finished");
    
    checkEntryParent();
    
    synchronized(parentList)
    {
      //remove the cursor from the list
      //this will set the parent list reference to null and make the
      //cursor seubsequently unusable
      forceRemove();      
    }    
    
    if (tc.isEntryEnabled())
      SibTr.exit(tc, "finished");        
  }
1128474
void gotoState(@Nonnull ConnectivityState newState) {
    checkNotNull(newState, "newState");
    if (state != newState && state != ConnectivityState.SHUTDOWN) {
      state = newState;
      if (listeners.isEmpty()) {
        return;
      }
      // Swap out callback list before calling them, because a callback may register new callbacks,
      // if run in direct executor, can cause ConcurrentModificationException.
      ArrayList<Listener> savedListeners = listeners;
      listeners = new ArrayList<>();
      for (Listener listener : savedListeners) {
        listener.runInExecutor();
      }
    }
  }
658202
public static <T> void whenAllDone(
      List<CompletionStage<T>> inputs, Runnable callback, Executor executor) {
    allDone(inputs).thenRunAsync(callback, executor).exceptionally(UncaughtExceptions::log);
  }
667256
def __call(self):
        
        try:
            if self.__callback is not None:
                self.__callback(self.__successes, self.__errors)
        except Exception as ex:
            self.__logger.exception("Error calling back count down "
                                    "handler: %s", ex)
        else:
            self.__called = True
630774
function AsyncLoop(iterations, _fn, _successCallback, offset) {
            if (offset === void 0) { offset = 0; }
            this.iterations = iterations;
            this._fn = _fn;
            this._successCallback = _successCallback;
            this.index = offset - 1;
            this._done = false;
        }
1243442
@Override
  public void onFailure(Throwable cause) {
    checkState();
    for (Callback<T> cb : callbacks) {
      cb.onFailure(cause);
    }
    callbacks = null; // note that we've fired
  }