Looks for a toHal(representation, next) method on the entity. If found, it is called asynchronously. The method may modify the
representation or pass back a completely new representation by calling next(newRep)
@param callback
15300
function (callback) {
            if (_.isFunction(rep.entity.toHal)) {
                rep.entity.toHal(rep, wrap(callback));
            } else {
                callback(null, rep);
            }
        }
36574
@SuppressWarnings("unchecked")
    @Override
    protected InvocationCallback<Object> checkAsyncCallback(OperationResourceInfo ori,
                                                            Map<String, Object> reqContext,
                                                            Message outMessage) {
        InvocationCallback<Object> callback = outMessage.getContent(InvocationCallback.class);
        if (callback == null && CompletionStage.class.equals(ori.getMethodToInvoke().getReturnType())) {
            callback = NO_OP_CALLBACK;
            outMessage.setContent(InvocationCallback.class, callback);
        }
        return callback;
    }
469664
@SuppressWarnings("WeakerAccess")
  public SnackbarBuilder showCallback(final SnackbarShowCallback callback) {
    callbacks.add(new SnackbarCallback() {
      public void onSnackbarShown(Snackbar snackbar) {
        callback.onSnackbarShown(snackbar);
      }
    });
    return this;
  }
121157
function(callback) {
                //We want it once for the object path.
                e.once('cp#complete', function(err, destination, method) {
                    if (err) {
                        console.error(err.stack)
                    }
                    console.debug('cp() completed copy to: ', method);
                    callback(err, destination, method)
                })
            }
500225
function(callback) {
            if (callback) {
                var name = this.name
                var indices = this.indexer.all();
                var keys = [];
                //Checking for the support of map.
                if(Array.prototype.map) {
                    keys = indices.map(function(r){ return r.replace(name + '.', '') })
                } else {
                    for (var key in indices) {
                        keys.push(key.replace(name + '.', ''));
                    }
                }
                this.fn('keys', callback).call(this, keys)
            }
            return this // TODO options for limit/offset, return promise
        }
490816
function one(callback) {
        ///<summary>Execute a callback only once</summary>
        callback = callback || noop;

        if (callback._done) {
            return;
        }

        callback();
        callback._done = 1;
    }
1371111
private static boolean addCallback(String applicationId, DelayedCallback callback) {
		boolean isFirst = false;
		List<DelayedCallback> list = BACKLOG.get(applicationId);
		if (null == list) {
			list = new ArrayList<DelayedCallback>();
			BACKLOG.put(applicationId, list);
			isFirst = true;
		}
		list.add(callback);
		return isFirst;
	}
768248
function(callback)
    {
        var self = this, items = [];
        
        var append = function(err, item) {
            if (err)
            {
                return callback(err);
            }
            if (item)
            {
                items.push(item);
                self.next(append);
            }
            else
            {
                callback(null, items);
            }
        };
        
        this.next(append);
    }
884820
public void putListener(CallbackType callbackType, Method method) {
    if (callbacks == null) {
      callbacks = new EnumMap<>(CallbackType.class);
    }
    Method oldMethod = callbacks.put(callbackType, method);
    if (oldMethod != null) {
      String format = "Class %s has at least two methods, %s and %s, with annotation of %s. "
          + "At most one method is allowed for a given callback type. ";
      String message = String.format(format, listenerClass.getName(), oldMethod.getName(),
          method.getName(), callbackType.getAnnotationClass().getName());
      throw new EntityManagerException(message);
    }
  }
629340
public void enqueue(@Nullable final Callback<T> callback) {
    checkIfExecuted();
    this.callback.set(callback);
    dispatcher.execute(new Runnable() {
      @Override public void run() {
        T result;
        try {
          result = perform();
        } catch (Exception e) {
          notifyFailure(new ApolloException("Failed to perform store operation", e));
          return;
        }

        notifySuccess(result);
      }
    });
  }
867912
@Override
  public final Future<WriteResponse> write(D record, @Nullable WriteCallback callback) {
    FutureWrappedWriteCallback wrappedWriteCallback = new FutureWrappedWriteCallback(callback);
    BufferedRecord<D> bufferedRecord = new BufferedRecord<>(record, wrappedWriteCallback);
    put(bufferedRecord);
    return wrappedWriteCallback;
  }
1195935
function next(cursor, callback) {
  // Return the currentDoc if someone called hasNext first
  if (cursor.s.currentDoc) {
    const doc = cursor.s.currentDoc;
    cursor.s.currentDoc = null;
    return callback(null, doc);
  }

  // Return the next object
  nextObject(cursor, callback);
}
1215542
@SuppressWarnings("unchecked")
    public void loopMap(final Object x, final MapIterCallback<K, V> callback) {
        if (x == null) {
            return;
        }

        if (x instanceof Collection) {
            throw new IllegalArgumentException("call loop instead");
        }

        if (x instanceof HashMap<?, ?>) {
            if (((HashMap) x).isEmpty()) {
                return;
            }

            final HashMap<?, ?> hm = (HashMap<?, ?>) x;
            for (final Entry<?, ?> e : hm.entrySet()) {
                callback.eval((K) e.getKey(), (V) e.getValue());
            }
            return;
        }
        if (x instanceof Map) {
            final Map<K, V> m = (Map<K, V>) x;
            for (final Entry<K, V> entry : m.entrySet()) {
                callback.eval(entry.getKey(), entry.getValue());
            }
            return;
        }
        if (x instanceof BSONObject) {
            final BSONObject m = (BSONObject) x;
            for (final String k : m.keySet()) {
                callback.eval((K) k, (V) m.get(k));
            }
        }

    }
289514
public void addCallback(final ClientTransport.PingCallback callback, Executor executor) {
    Runnable runnable;
    synchronized (this) {
      if (!completed) {
        callbacks.put(callback, executor);
        return;
      }
      // otherwise, invoke callback immediately (but not while holding lock)
      runnable = this.failureCause != null ? asRunnable(callback, failureCause)
                                           : asRunnable(callback, roundTripTimeNanos);
    }
    doExecute(executor, runnable);
  }
1289079
public <T extends IEntity> void addAsync(T entity, CallbackHandler callbackHandler) throws FMSException {

        IntuitMessage intuitMessage = prepareAdd(entity);

        //set callback handler
        intuitMessage.getRequestElements().setCallbackHandler(callbackHandler);

        //execute async interceptors
        executeAsyncInterceptors(intuitMessage);
    }
443415
public void readAlways(UDPReadCompletedCallbackThreaded callback, boolean enable) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "readAlways(enable=" + enable + ")");
        }
        if (enable) {
            this.readAlwaysCallback = callback;
        } else {
            this.readAlwaysCallback = null;
        }

        getWorkQueueManager().processWork(this);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "readAlways()");
        }
    }
998735
function(cb) {
        cb = this.wrap(cb);
        this._callbacks.push(cb);
        if (!this._isQueueRunning) {
            if (this.start) {
                this.start();
            } else this.next();
            // this.start();
        }
        return this;
    }