Submits a finalizer internally.

@param flvFinalizer
@return Future representing task
769722
private Future<?> submit(FLVFinalizer flvFinalizer) {
        if (executor != null && !executor.isTerminated()) {
            return executor.submit(flvFinalizer);
        }
        return null;
    }
1233312
protected Event finalizeResponseEvent(final RequestContext requestContext, final WebApplicationService service, final Response response) {
        WebUtils.putServiceResponseIntoRequestScope(requestContext, response);
        WebUtils.putServiceOriginalUrlIntoRequestScope(requestContext, service);
        val eventId = getFinalResponseEventId(service, response, requestContext);
        return new EventFactorySupport().event(this, eventId);
    }
765443
public /** FIXME: should be final or at least protected */ Job start(final H2OCountedCompleter fjtask) {
    assert state == JobState.CREATED : "Trying to run job which was already run?";
    assert fjtask != null : "Starting a job with null working task is not permitted! Fix you API";
    _fjtask = fjtask;
    start_time = System.currentTimeMillis();
    state      = JobState.RUNNING;
    // Save the full state of the job
    UKV.put(self(), this);
    // Update job list
    new TAtomic<List>() {
      @Override public List atomic(List old) {
        if( old == null ) old = new List();
        Key[] jobs = old._jobs;
        old._jobs = Arrays.copyOf(jobs, jobs.length + 1);
        old._jobs[jobs.length] = job_key;
        return old;
      }
    }.invoke(LIST);
    return this;
  }
975986
def finalize(self):
        
        if self.finalized:
            self.history.warning("Calling finalize on an already finalized flow.")
            return 1

        self.history.info("Calling flow.finalize.")
        self.finalized = True

        if self.has_db:
            self.history.info("Saving results in database.")
            try:
                self.flow.db_insert()
                self.finalized = True
            except Exception:
                 logger.critical("MongoDb insertion failed.")
                 return 2

        # Here we remove the big output files if we have the garbage collector
        # and the policy is set to "flow."
        if self.gc is not None and self.gc.policy == "flow":
            self.history.info("gc.policy set to flow. Will clean task output files.")
            for task in self.iflat_tasks():
                task.clean_output_files()

        return 0
1149911
def __FinalizeRequest(self, http_request, url_builder):
        """"""
        if (http_request.http_method == 'GET' and
                len(http_request.url) > _MAX_URL_LENGTH):
            http_request.http_method = 'POST'
            http_request.headers['x-http-method-override'] = 'GET'
            http_request.headers[
                'content-type'] = 'application/x-www-form-urlencoded'
            http_request.body = url_builder.query
            url_builder.query_params = {}
        http_request.url = url_builder.url
65440
private function hasFinishedSuccessfullyAsync($finalizeResponse)
    {
        // Again using an Iterator function to generate the threads.
        $promises = $this->pollStatusIterator($finalizeResponse);
        $eachPromises = new Promise\EachPromise($promises, [
            'concurrency' => 1,
            'fulfilled' => function ($pollStatus, $i, $promise) {
                if ($pollStatus != null) {
                    if (!empty($pollStatus['itemsDone'])) {
                        $promise->resolve($pollStatus['itemsDone']);
                    }
                    if (!empty($pollStatus['itemsFailed'])) {
                        $promise->resolve(false);
                    }
                }
                return false;
            }
        ]);
        return $eachPromises->promise();
    }
692801
public CompletableFuture<Void> close() {
    CompletableFuture<Void> future = new CompletableFuture<>();
    submitter.close()
      .thenCompose(v -> listener.close())
      .thenCompose(v -> manager.close())
      .whenComplete((managerResult, managerError) -> {
        connection.close().whenComplete((connectionResult, connectionError) -> {
          if (managerError != null) {
            future.completeExceptionally(managerError);
          } else if (connectionError != null) {
            future.completeExceptionally(connectionError);
          } else {
            future.complete(null);
          }
        });
      });
    return future;
  }
942035
protected <T> Future<T> invokeSubmit(ExecutorService executor, Callable<T> task) {
    return executor.submit(wrapTask(task));
  }
32546
JobSubmissionResult finalizeExecute() throws ProgramInvocationException {
		return client.run(detachedPlan, jarFilesToAttach, classpathsToAttach, userCodeClassLoader, savepointSettings);
	}
1020011
public Future<?> submitAfter(Waiter waiter, Runnable runnable)
    {
        return submitAfter(waiter, runnable, Long.MAX_VALUE, TimeUnit.MILLISECONDS);
    }
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;
    }
571253
public static<T> Future<T> submit(Callable<T> task, String message) {
		logger.debug("Task " + (++tasks) + " submitted to shared thread pool. " + message);
		return getThreadPool().submit(task);
	}
655942
public <T> CompletableFuture<T> submit(Query<T> query) {
    State state = state();
    if (state == State.CLOSED || state == State.EXPIRED) {
      return Futures.exceptionalFuture(new ClosedSessionException("session closed"));
    }
    return submitter.submit(query);
  }
934947
def finalize(self):
        
        super(StringWriterConsumer, self).finalize()
        self.result = self.decoder(self.result)
1196138
public void complete() throws CompletionFailure {
        if (completer != null) {
            Completer c = completer;
            completer = null;
            c.complete(this);
        }
    }
450084
static <T> RedisFuture<T> lastOfAsync(Map<?, ? extends CompletionStage<T>> executions) {

        return new PipelinedRedisFuture<>(executions, objectPipelinedRedisFuture -> {
            // make sure, that all futures are executed before returning the result.
                T result = null;
                for (CompletionStage<T> future : executions.values()) {
                    result = execute(() -> future.toCompletableFuture().get());
                }
                return result;
            });
    }
1235453
def handle_wf_finalization(self):
        
        if ((not self.current.flow_enabled or (
            self.current.task_type.startswith('End') and not self.are_we_in_subprocess())) and
                    'token' in self.current.output):
            del self.current.output['token']