Executes the given Callable synchronously and invokes cleanup when done.

@param operation    The Callable to execute.
329872
private <R> CompletableFuture<R> execute(Callable<R> operation) {
        return CompletableFuture.supplyAsync(() -> {
            try {
                return operation.call();
            } catch (Exception ex) {
                throw new CompletionException(ex);
            }
        }, this.executor);
    }
1348526
public void add(Operation operation) {
		synchronized (operations) {
			operations.addLast(operation);
			if (waiting)
				sp.unblock();
		}
		if (autoStart && operations.size() == 1 && getStatus() == Task.STATUS_NOT_STARTED)
			start();
	}
977431
private synchronized <R> OperationResult<R> executeDdlOperation(AbstractOperationImpl<R> operation, RetryPolicy retry)
             throws OperationException, ConnectionException {
         ConnectionException lastException = null;
         for (int i = 0; i < 2; i++) {
             operation.setPinnedHost(ddlHost);
             try {
                 OperationResult<R> result = connectionPool.executeWithFailover(operation, retry);
                 ddlHost = result.getHost();
                 return result;
             }
             catch (ConnectionException e) {
                lastException = e;
                if (e instanceof IsDeadConnectionException) {
                     ddlHost = null;
                }
             }
         }
         throw lastException;
    }
34989
void performCleanUp(@Nullable Runnable task) {
    evictionLock.lock();
    try {
      maintenance(task);
    } finally {
      evictionLock.unlock();
    }
    if ((drainStatus() == REQUIRED) && (executor == ForkJoinPool.commonPool())) {
      scheduleDrainBuffers();
    }
  }
1199908
@Override
    public CompletableFuture<Void> add(Operation operation, Duration timeout) {
        ensureRunning();
        return this.operationProcessor.process(operation);
    }
1807
protected void invoke(String serviceName, Operation operation, int partitionId) {
        try {
            operationCount++;
            operationService
                    .invokeOnPartition(serviceName, operation, partitionId)
                    .andThen(mergeCallback);
        } catch (Throwable t) {
            throw rethrow(t);
        }
    }
42930
public void perform() {
        for (int i = 0; i < operations.size(); i++) {
            operations.get(i).process();
        }
    }
1351870
public <X> DataSet<X> runOperation(CustomUnaryOperation<T, X> operation) {
		Validate.notNull(operation, "The custom operator must not be null.");
		operation.setInput(this);
		return operation.createResult();
	}
70702
private void processNewOperation(StorageOperation operation) {
        if (operation instanceof MergeSegmentOperation) {
            this.operations.add(operation);
            this.mergeTransactionCount.incrementAndGet();
        } else if (operation instanceof StreamSegmentSealOperation) {
            this.operations.add(operation);
            this.hasSealPending.set(true);
        } else if (operation instanceof StreamSegmentTruncateOperation) {
            this.operations.add(operation);
            this.truncateCount.incrementAndGet();
        } else if (operation instanceof CachedStreamSegmentAppendOperation) {
            // Aggregate the Append Operation.
            AggregatedAppendOperation aggregatedAppend = getOrCreateAggregatedAppend(
                    operation.getStreamSegmentOffset(), operation.getSequenceNumber());
            aggregateAppendOperation((CachedStreamSegmentAppendOperation) operation, aggregatedAppend);
        }
    }
454929
@Override
    public void execute(Runnable task) {
        try {
            this.concurrentExecutor.execute(task);
        } catch (RejectedExecutionException ex) {
            throw new TaskRejectedException("Executor [" + this.concurrentExecutor + "] did not accept task: " + task,
                    ex);
        }
    }
1192489
private function runOperation(Operation $operation)
    {
        try {
            return $this->runner->run($operation);
        } catch (\Throwable $e) {
            // treated below
        } catch (\Exception $e) {
            // treated below
        }

        // @todo keep only inner if once ExceptionCatcher is gone
        if ($this->exceptionCatcherVoter instanceof ThrowableCatcherVoter) {
            if (!$this->exceptionCatcherVoter->shouldCatchThrowable($e)) {
                throw $e;
            }
        } elseif (!$this->exceptionCatcherVoter->shouldCatch($e)) {
            throw $e;
        }

        try {
            $this->waitStrategy->wait();
        } catch (WaiterException $waiterException) {
            throw $e;
        }

        return $this->runOperation($operation);
    }
705443
public void each(Consumer<T> operation) {
		for (T component : components) {
			operation.accept(component);
		}
	}
311646
protected <V> V executeUpdate (Operation<V> op)
        throws PersistenceException
    {
        return execute(op, true, false);
    }
213941
@Override
    public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
        if (requiresRuntime(context) && !isProfile(context)) {
            context.addStep(new OperationStepHandler() {
                @Override
                public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
                    // make sure the resource exists before executing a runtime operation.
                    // if that's not the case, the operation will report an error with a comprehensive failure
                    // description instead of a subsequent exception (such as a NPE).
                    if (resourceMustExist(context, operation)) {
                        context.readResource(PathAddress.EMPTY_ADDRESS, false);
                    }
                    executeRuntimeStep(context, operation);
                }
            }, OperationContext.Stage.RUNTIME);
        }
    }
317398
public void retryOperation(Operation op) {
    if (retryQueueSize >= 0 && retryOps.size() >= retryQueueSize) {
      if (!op.isCancelled()) {
        op.cancel();
      }
    }
    retryOps.add(op);
  }
1117850
def call_operation(self, operation, **kwargs):
        
        data = {'operation': operation}
        data.update(kwargs)
        return self.invoke(data)
1358637
synchronized void execute(File root, Runnable task) {
    if (executors == null) {
      throw new RuntimeException("AsyncDiskService is already shutdown");
    }
    ThreadPoolExecutor executor = executors.get(root);
    if (executor == null) {
      throw new RuntimeException("Cannot find root " + root
          + " for execution of task " + task);
    } else {
      executor.execute(task);
    }
  }