Copies this {@code Include} to the given task. A {@link TaskCloneException} is thrown if this {@code Include} is eager.
@param task the task to be filled
@return the given task for chaining
@throws TaskCloneException if this {@code Include} is eager.
5183
@Override
	protected Task<E> copyTo (Task<E> task) {
		if (!lazy) throw new TaskCloneException("A non-lazy " + getClass().getSimpleName() + " should never be copied.");

		Include<E> include = (Include<E>)task;
		include.subtree = subtree;
		include.lazy = lazy;

		return task;
	}
722922
private Task taskToBeRescheduled(Task task) {
        Task taskToBeRetried = task.copy();
        taskToBeRetried.setTaskId(IDGenerator.generate());
        taskToBeRetried.setRetriedTaskId(task.getTaskId());
        taskToBeRetried.setStatus(SCHEDULED);
        taskToBeRetried.setRetryCount(task.getRetryCount() + 1);
        taskToBeRetried.setRetried(false);
        taskToBeRetried.setPollCount(0);
        taskToBeRetried.setCallbackAfterSeconds(0);
        task.setRetried(true);
        return taskToBeRetried;
    }
672170
public static <T> CombinedDownloadTask<T> single(DownloadTask<T> task) {
		Objects.requireNonNull(task);
		return new SingleCombinedTask<T>(task);
	}
741947
protected void addTask(Runnable task) {
        if (task == null) {
            throw new NullPointerException("task");
        }
        if (!offerTask(task)) {
            reject(task);
        }
    }
1086333
public <TContinuationResult> Task<TContinuationResult> continueWithTask(
      Continuation<TResult, Task<TContinuationResult>> continuation) {
    return continueWithTask(continuation, IMMEDIATE_EXECUTOR, null);
  }
1072108
public <TContinuationResult> Task<TContinuationResult> onSuccessTask(
      final Continuation<TResult, Task<TContinuationResult>> continuation, Executor executor,
      final CancellationToken ct) {
    return continueWithTask(new Continuation<TResult, Task<TContinuationResult>>() {
      @Override
      public Task<TContinuationResult> then(Task<TResult> task) {
        if (ct != null && ct.isCancellationRequested()) {
          return Task.cancelled();
        }

        if (task.isFaulted()) {
          return Task.forError(task.getError());
        } else if (task.isCancelled()) {
          return Task.cancelled();
        } else {
          return task.continueWithTask(continuation);
        }
      }
    }, executor);
  }
1082116
async def insert(self, task: Task) -> None:
        ''''''

        if not isinstance(task, Task):
            task = task()

        if task.name not in self.all_tasks:
            task.tasky = self
            self.all_tasks[task.name] = task

            await task.init()

        elif task != self.all_tasks[task.name]:
            raise Exception('Duplicate task %s' % task.name)

        if task.enabled:
            task.task = asyncio.ensure_future(self.start_task(task))
            self.running_tasks.add(task)
        else:
            task.task = None

        return task
1256022
public static JoinPoint<Exception> fromTasks(Task<?,?>... tasks) {
		JoinPoint<Exception> jp = new JoinPoint<>();
		for (Task<?,?> task : tasks) jp.addToJoin(task.getOutput());
		jp.start();
		return jp;
	}
439015
public void registerTask(Task task) throws IOException {
		final ResultPartition[] producedPartitions = task.getProducedPartitions();

		synchronized (lock) {
			if (isShutdown) {
				throw new IllegalStateException("NetworkEnvironment is shut down");
			}

			for (final ResultPartition partition : producedPartitions) {
				setupPartition(partition);
			}

			// Setup the buffer pool for each buffer reader
			final SingleInputGate[] inputGates = task.getAllInputGates();
			for (SingleInputGate gate : inputGates) {
				setupInputGate(gate);
			}
		}
	}
405637
public void setTasks(java.util.Collection<ImportTask> tasks) {
        if (tasks == null) {
            this.tasks = null;
            return;
        }

        this.tasks = new java.util.ArrayList<ImportTask>(tasks);
    }
254388
public void readTask(Task task) {
        Map<String, String> props = task.getProperties();
        setAccount(props.get(ACCOUNT_PROP));
        setStoreId(props.get(STORE_ID_PROP));
        setSpaceId(props.get(SPACE_ID_PROP));
        this.attempts = task.getAttempts();
    }
852480
private void writeTask(Task task) throws IOException
   {
      writeFields(null, task, TaskField.values());
      for (Task child : task.getChildTasks())
      {
         writeTask(child);
      }
   }
244385
public static <T extends Callable<?> & Parcelable> Intent taskIntent(final Context context,
                                                                       final T task) {
    return taskIntent(context, Goro.DEFAULT_QUEUE, task);
  }
1173966
public T clicked(final CocoTask<?> task) {
        return clicked(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                query.task(task);
            }
        });
    }
836095
protected Runnable wrapTask(Runnable task) {
    // Preserve the MDC context of the caller thread.
    Map contextMap = MDC.getCopyOfContextMap();
    if (contextMap != null) {
      return new MDCRunnableAdapter(task, contextMap);
    }
    return task;
  }
636738
public void accept(Task task) {
    	if((activeIndex+1)%2==0)
    	{
    		if(!task.isInQueue0())
    		{
    			taskList[0].offer(task);
    			task.storedInQueue0();
    		}
    	}
    	else
    	{
    		if(!task.isInQueue1())
    		{
    			taskList[1].offer(task);
    			task.storedInQueue1();
    		}
    	}    	    	    
    }
404981
public List<TaskLock> findLocksForTask(final Task task)
  {
    giant.lock();

    try {
      return Lists.transform(
          findLockPossesForTask(task), new Function<TaskLockPosse, TaskLock>()
          {
            @Override
            public TaskLock apply(TaskLockPosse taskLockPosse)
            {
              return taskLockPosse.getTaskLock();
            }
          }
      );
    }
    finally {
      giant.unlock();
    }
  }