restarts a Task from outstandingTasks.

@param task The failed Task.
@throws ExecutionException for failed restart of the task
960867
public final void restartTask (final ITask task) throws ExecutionException {

        try {
            if (task != null) {
                if (task instanceof IOTask) {
                    executor.submit((IOTask) task);
                } else {
                    task.call();
                }
                taskBalancer.releaseConnection(outstandingTasks.get(task));
                outstandingTasks.remove(task);
            }
            LOGGER.debug("Restarted a Task out of the outstandingTasks Queue");
        } catch (Exception e) {
            throw new ExecutionException(e);
        }
    }
1086333
public <TContinuationResult> Task<TContinuationResult> continueWithTask(
      Continuation<TResult, Task<TContinuationResult>> continuation) {
    return continueWithTask(continuation, IMMEDIATE_EXECUTOR, null);
  }
256317
private void writeTask(Task task)
   {
      if (!task.getNull())
      {
         if (extractAndConvertTaskType(task) == null || task.getSummary())
         {
            writeWBS(task);
         }
         else
         {
            writeActivity(task);
         }
      }
   }
967698
public void add(Task task) {
    	synchronized(LOCK) {
    		//terminated task will be selected immediately before start
    		task.setListener(this);
        
    		this.task[wi] = task;        
        
    		wi++;
    	}
    }
496073
public static void runIgnoringConstraintViolation(Runnable task)
    {
        try {
            task.run();
        }
        catch (RuntimeException e) {
            if (!sqlCodeStartsWith(e, "23")) {
                throw e;
            }
        }
    }
213512
public void setTaskExecutions(java.util.Collection<TaskExecutionListEntry> taskExecutions) {
        if (taskExecutions == null) {
            this.taskExecutions = null;
            return;
        }

        this.taskExecutions = new java.util.ArrayList<TaskExecutionListEntry>(taskExecutions);
    }
470767
@GuardedBy("evictionLock")
    void runTasks(Task[] tasks, int maxTaskIndex) {
        for (int i = 0; i <= maxTaskIndex; i++) {
            runTasksInChain(tasks[i]);
        }
    }
1289503
@Override
	public void onTaskFailure(Execution taskExecution, Throwable cause) {
		final ExecutionVertex ev = taskExecution.getVertex();
		final FailoverRegion failoverRegion = vertexToRegion.get(ev);

		if (failoverRegion == null) {
			executionGraph.failGlobal(new FlinkException(
					"Can not find a failover region for the execution " + ev.getTaskNameWithSubtaskIndex(), cause));
		}
		else {
			LOG.info("Recovering task failure for {} #{} ({}) via restart of failover region",
					taskExecution.getVertex().getTaskNameWithSubtaskIndex(),
					taskExecution.getAttemptNumber(),
					taskExecution.getAttemptId());

			failoverRegion.onExecutionFail(taskExecution, cause);
		}
	}
163649
public void commitTask(TaskAttemptContext context) 
  throws IOException {
    TaskAttemptID attemptId = context.getTaskAttemptID();
    if (workPath != null) {
      context.progress();
      if (outputFileSystem.exists(workPath)) {
        // Move the task outputs to their final place
        moveTaskOutputs(context, outputFileSystem, outputPath, workPath);
        // Delete the temporary task-specific output directory
        if (!outputFileSystem.delete(workPath, true)) {
          LOG.warn("Failed to delete the temporary output" + 
          " directory of task: " + attemptId + " - " + workPath);
        }
        LOG.info("Saved output of task '" + attemptId + "' to " + 
                 outputPath);
      }
    }
  }
104429
@Override
  public ListenableFuture<TaskStatus> run(final Task task)
  {
    final RemoteTaskRunnerWorkItem completeTask, runningTask, pendingTask;
    if ((pendingTask = pendingTasks.get(task.getId())) != null) {
      log.info("Assigned a task[%s] that is already pending!", task.getId());
      runPendingTasks();
      return pendingTask.getResult();
    } else if ((runningTask = runningTasks.get(task.getId())) != null) {
      ZkWorker zkWorker = findWorkerRunningTask(task.getId());
      if (zkWorker == null) {
        log.warn("Told to run task[%s], but no worker has started running it yet.", task.getId());
      } else {
        log.info("Task[%s] already running on %s.", task.getId(), zkWorker.getWorker().getHost());
        TaskAnnouncement announcement = zkWorker.getRunningTasks().get(task.getId());
        if (announcement.getTaskStatus().isComplete()) {
          taskComplete(runningTask, zkWorker, announcement.getTaskStatus());
        }
      }
      return runningTask.getResult();
    } else if ((completeTask = completeTasks.get(task.getId())) != null) {
      return completeTask.getResult();
    } else {
      return addPendingTask(task).getResult();
    }
  }
617969
@Override
  public void onFailedTask() {
    LOG.entering("TaskNodeImpl", "onFailedTask", getQualifiedName());
    if (!running.compareAndSet(true, false)) {
      LOG.fine(getQualifiedName() + "Trying to set failed on an already failed task. Something fishy!!!");
      LOG.exiting("TaskNodeImpl", "onFailedTask", getQualifiedName() +
          "Trying to set failed on an already failed task. Something fishy!!!");
      return;
    }
    taskNodeStatus.clearStateAndReleaseLocks();
    LOG.finest(getQualifiedName() + "Changed status to failed.");
    LOG.finest(getQualifiedName() + "Resetting topoSetupSent to false");
    topoSetupSent.set(false);
    if (parent != null && parent.isRunning()) {
      parent.onChildDead(taskId);
    } else {
      LOG.finest(getQualifiedName() + "Skipping asking parent to process child death");
    }
    for (final TaskNode child : children) {
      if (child.isRunning()) {
        child.onParentDead();
      }
    }
    final int newVersion = this.version.incrementAndGet();
    LOG.finest(getQualifiedName() + "Bumping up to version-" + newVersion);
    LOG.exiting("TaskNodeImpl", "onFailedTask", getQualifiedName());
  }
486186
private Runnable decorateTask(Runnable task, boolean isRepeatingTask) {
        Runnable result = TaskUtils.decorateTaskWithErrorHandler(task, this.errorHandler, isRepeatingTask);
        if (this.enterpriseConcurrentScheduler) {
            result = ManagedTaskBuilder.buildManagedTask(result, task.toString());
        }
        return result;
    }
436718
public function restart()
    {
        if (count($this->tasks) == 0)
            throw new \Exception("There are no tasks defined - can not restart");

        $this->stop();

        do {
            sleep(1);
        } while ($this->getPid() !== false);

        $this->start();
    }
496384
public void execute(final FifoTask<E> task) throws InterruptedException {
        final int id;
        synchronized (this) {
            id = idCounter++;
            taskMap.put(id, task);
            while (activeCounter >= maxThreads) {
                wait();
            }
            activeCounter++;
        }

        this.threadPoolExecutor.execute(new Runnable() {
            public void run() {
                try {
                    try {
                        final E outcome = task.runParallel();
                        synchronized (resultMap) {
                            resultMap.put(id, new Result(outcome));
                        }
                    } catch (Throwable th) {
                        synchronized (resultMap) {
                            resultMap.put(id, new Result(null, th));
                        }
                    } finally {
                        processResults();
                        synchronized (FifoTaskExecutor.this) {
                            activeCounter--;
                            FifoTaskExecutor.this.notifyAll();
                        }
                    }
                } catch (Exception ex) {
                    Logger.getLogger(FifoTaskExecutor.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                }
            }
        });
    }
1168245
@Override
    protected void afterExecute(Runnable r, Throwable t) {
        super.afterExecute(r, t);
        if (t == null && r instanceof Future<?>) {
            try {
                ((Future<?>) r).get();
            } catch (CancellationException ce) {
                t = ce;
            } catch (ExecutionException ee) {
                t = ee.getCause();
            } catch (InterruptedException ie) {
                Thread.currentThread().interrupt(); // ignore/reset
            }
        }
        if (t != null) {
            ARouter.logger.warning(Consts.TAG, "Running task appeared exception! Thread [" + Thread.currentThread().getName() + "], because [" + t.getMessage() + "]\n" + TextUtils.formatStackTrace(t.getStackTrace()));
        }
    }
242936
public synchronized void restart() throws IllegalStateException {

        if (this.isShutdown) {
            throw new IllegalStateException("isShutdown==true");
        } else if (this.taskRunnerThread == null) {
            this.taskRunnerThread =
                this.threadFactory.newThread(this.taskRunner);

            this.taskRunnerThread.start();
        } else {
            this.taskQueue.unpark();
        }
    }
44915
public void setTasks(java.util.Collection<TaskListEntry> tasks) {
        if (tasks == null) {
            this.tasks = null;
            return;
        }

        this.tasks = new java.util.ArrayList<TaskListEntry>(tasks);
    }