Returns execution properties for the task.

@param task the task being submitted for execution.
@return execution properties for the task.
763783
final Map<String, String> getExecutionProperties(Object task) {
        if (task == null) // NullPointerException is required per the JavaDoc API
            throw new NullPointerException(Tr.formatMessage(tc, "CWWKC1111.task.invalid", (Object) null));

        Map<String, String> execProps = task instanceof ManagedTask ? ((ManagedTask) task).getExecutionProperties() : null;
        if (execProps == null)
            execProps = defaultExecutionProperties.get();
        else {
            execProps = new TreeMap<String, String>(execProps);
            String tranProp = execProps.remove(ManagedTask.TRANSACTION);
            if (tranProp != null && !ManagedTask.SUSPEND.equals(tranProp)) // USE_TRANSACTION_OF_EXECUTION_THREAD not valid for managed tasks
                throw new RejectedExecutionException(Tr.formatMessage(tc, "CWWKC1130.xprop.value.invalid", name, ManagedTask.TRANSACTION, tranProp));
            if (!execProps.containsKey(WSContextService.DEFAULT_CONTEXT))
                execProps.put(WSContextService.DEFAULT_CONTEXT, WSContextService.UNCONFIGURED_CONTEXT_TYPES);
            if (!execProps.containsKey(WSContextService.TASK_OWNER))
                execProps.put(WSContextService.TASK_OWNER, name.get());
        }
        return execProps;
    }
1046040
@Service
    public Map<String, Integer> getTaskQueueSizes(List<String> taskTypes) {
        return executionService.getTaskQueueSizes(taskTypes);
    }
247618
public function get_element_properties(base_task $task = null, renderer_base $output = null) {
        if (!array_key_exists('optional', $this->attributes)) {
            $this->attributes['optional'] = false;
        }
        $properties = parent::get_element_properties($task, $output);
        $properties['element'] = 'date_selector';
        return $properties;
    }
248937
public Future<?> submit(Task task) {
    LOG.info(String.format("Submitting task %s", task.getTaskId()));
    return this.taskExecutor.submit(new TrackingTask(task));
  }
175220
public List<String> encodeTask(final Task<Diff> task)
		throws ConfigurationException, UnsupportedEncodingException,
		DecodingException, EncodingException, SQLConsumerException
	{

		// this.task = task;
		if (task.getTaskType() == TaskTypes.TASK_FULL
				|| task.getTaskType() == TaskTypes.TASK_PARTIAL_FIRST) {

			this.lastFullRevID = -1;
		}

		int articleId = task.getHeader().getArticleId();
		Diff diff;

		ArrayList<String> list = new ArrayList<String>();

		String tempData = new String();

		int size = task.size();
		for (int i = 0; i < size; i++) {

			diff = task.get(i);

			if (diff.isFullRevision()) {
				this.lastFullRevID = diff.getRevisionID();
			}

			/*
			 * prepare values that might be null
			 * because we don't want quotes if they are null
			 *
			 * Furthermore, escape quote-characters. Quotes are used as the "ENCLOSED BY" character
			 * in MySQL to mark begin and end of Strings
			 */

			//prepare values that might be null
			//because we don't want quotes if they are null
			String comm = diff.getComment();
			String comment = comm==null?"\\N":"\""+escape(comm)+"\"";

			Integer cId = diff.getContributorId();
			String contributorId = cId==null?"\\N":cId.toString();

			String cName = diff.getContributorName();
			String contributorName = cName==null?"\\N":"\""+escape(cName)+"\"";

			//Prepare the actual data item
			tempData = "\\N,"
					+ this.lastFullRevID + ","
					+ diff.getRevisionCounter() + ","
					+ diff.getRevisionID()+ ","
					+ articleId + ","
					+ diff.getTimeStamp().getTime()+ ",\""
					+ encodeDiff(task, diff) + "\","
					+ comment+","
					+ (diff.isMinor()?"1":"0")+","
					+ contributorName+","
					+ contributorId+ ","
					+ (diff.getContributorIsRegistered()?"1":"0");

			//add item to the list
			list.add(tempData);
		}

		return list;
	}
867330
public static Object getProperty(Object target, String property) {
    try {
      return InvokerHelper.getProperty(target, property);
    } catch (InvokerInvocationException e) {
      ExceptionUtil.sneakyThrow(e.getCause());
      return null; // never reached
    }
  }
1123853
public function get_element_properties(base_task $task = null, renderer_base $output = null) {
        $icon = $this->get_icon();
        $context = context_course::instance($task->get_courseid());
        $label = format_string($this->get_label($task), true, array('context' => $context));
        if (!empty($icon)) {
            $label .= $output->render($icon);
        }
        // Name, label, options, attributes.
        return $this->apply_options(array(
            'element' => 'select',
            'name' => self::NAME_PREFIX.$this->name,
            'label' => $label,
            'options' => $this->values,
            'attributes' => $this->attributes
        ));
    }
725920
public TaskExecutor spawnExecutor(Task task) {
		final TaskExecutor executor = new TaskExecutor(this.scheduler, task);
		synchronized (this.executors) {
			this.executors.add(executor);
		}
		// 子线程是否为deamon线程取决于父线程，因此此处无需显示调用
		// executor.setDaemon(this.scheduler.daemon);
//		executor.start();
		this.scheduler.threadExecutor.execute(executor);
		return executor;
	}
600716
@Override
    public TaskProcessor create(Task task) throws TaskProcessorCreationFailedException {

        MultiStepTaskProcessor processor = new MultiStepTaskProcessor();

        for (TaskProcessorFactory factory : factories) {
            processor.addTaskProcessor(factory.create(task));
        }

        return processor;
    }
1320409
public ResponseFromManager generateUpdateExecuteTask(ParallelTask task) {

        // add to map now; as can only pass final
        ParallelTaskManager.getInstance().addTaskToInProgressMap(
                task.getTaskId(), task);
        logger.info("Added task {} to the running inprogress map...",
                task.getTaskId());

        boolean useReplacementVarMap = false;
        boolean useReplacementVarMapNodeSpecific = false;
        Map<String, StrStrMap> replacementVarMapNodeSpecific = null;
        Map<String, String> replacementVarMap = null;

        ResponseFromManager batchResponseFromManager = null;

        switch (task.getRequestReplacementType()) {
        case UNIFORM_VAR_REPLACEMENT:
            useReplacementVarMap = true;
            useReplacementVarMapNodeSpecific = false;
            replacementVarMap = task.getReplacementVarMap();
            break;
        case TARGET_HOST_SPECIFIC_VAR_REPLACEMENT:
            useReplacementVarMap = false;
            useReplacementVarMapNodeSpecific = true;
            replacementVarMapNodeSpecific = task
                    .getReplacementVarMapNodeSpecific();
            break;
        case NO_REPLACEMENT:
            useReplacementVarMap = false;
            useReplacementVarMapNodeSpecific = false;
            break;
        default:
            logger.error("error request replacement type. default as no replacement");
        }// end switch

        // generate content in nodedata
        InternalDataProvider dp = InternalDataProvider.getInstance();
        dp.genNodeDataMap(task);

        VarReplacementProvider.getInstance()
                .updateRequestWithReplacement(task, useReplacementVarMap,
                        replacementVarMap, useReplacementVarMapNodeSpecific,
                        replacementVarMapNodeSpecific);

        batchResponseFromManager = 
                sendTaskToExecutionManager(task);

        removeTaskFromInProgressMap(task.getTaskId());
        logger.info(
                "Removed task {} from the running inprogress map... "
                        + ". This task should be garbage collected if there are no other pointers.",
                task.getTaskId());
        return batchResponseFromManager;

    }
798493
private java.util.Map<JobHistory.Keys, String> getLastSuccessfulTaskAttempt(JobHistory.Task task) {
    
    Map<String, JobHistory.TaskAttempt> taskAttempts = task.getTaskAttempts();
    int size = taskAttempts.size();
    java.util.Iterator<Map.Entry<String, JobHistory.TaskAttempt>> kv = taskAttempts.entrySet().iterator();
    for (int i=0; i<size; i++) {
      // CHECK_IT: Only one SUCCESSFUL TASK ATTEMPT
      Map.Entry<String, JobHistory.TaskAttempt> tae = kv.next();
      JobHistory.TaskAttempt attempt = tae.getValue();
      if (attempt.getValues().get(JobHistory.Keys.TASK_STATUS).equals("SUCCESS")) {
        return attempt.getValues();
      }
    }
    
    return null;
  }
1070120
@Override
    public Map<String, String[]> getClassProperties(final String name, final String... propertyNames) throws DevFailed {
        return cache.getClassProperties(name, propertyNames);
    }
378134
private AuditUtilityTask getTask(String taskName) {
        AuditUtilityTask task = null;
        for (AuditUtilityTask availTask : tasks) {
            if (availTask.getTaskName().equals(taskName)) {
                task = availTask;
            }
        }
        return task;
    }
399175
public void addTaskProperties(Task task)
    {
    	if (task == null)
    		return;
        this.put(TrxMessageHeader.USER_ID, task.getProperty(DBParams.USER_ID));
//?         BaseDatabase.addDBProperties(m_mapMessageHeader, task, null);	// Note: m_mapMessageHeader is guaranteed not null by previous call.
    }
694710
public static task_command_log[] get(nitro_service client) throws Exception
	{
		task_command_log resource = new task_command_log();
		resource.validate("get");
		return (task_command_log[]) resource.get_resources(client);
	}
120004
public <T> T execute(Task<T> task) {
        synchronized(task) {
            task.reset();
            // add it to the tail
            taskList.add(task);

            // invoke the execution
            lock.activate();

            // wait for the completion
            try {
            	while (!task.isDone()) {
            		task.wait();
            	}
            } catch (InterruptedException e) {
                task.exception = e; // we got interrupted, so task.result will be invalid! 
            }

            if(task.exception!=null) {
                Throwable e = task.exception;
                task.exception = null;
                throw new ExecutionException(e);
            } else {
                T r = task.result;
                task.result = null;
                return r;
            }
        }
    }
616890
@TaskAction
	public void generateBuildProperties() {
		try {
			new BuildPropertiesWriter(new File(getDestinationDir(),
					"build-info.properties")).writeBuildProperties(new ProjectDetails(
							this.properties.getGroup(),
							(this.properties.getArtifact() != null)
									? this.properties.getArtifact() : "unspecified",
							this.properties.getVersion(), this.properties.getName(),
							this.properties.getTime(),
							coerceToStringValues(this.properties.getAdditional())));
		}
		catch (IOException ex) {
			throw new TaskExecutionException(this, ex);
		}
	}