public void createTask(ProcessContext context, ProcessNodeTask taskConfig) {
		if (taskConfig == null)
			throw new RuntimeException("taskConfig should not be null!");
		if (context == null)
			throw new RuntimeException("context should not be null!");
		ProcessTaskInstance taskInstance = this.intantiateTask();
		taskInstance.setTaskName(taskConfig.getName());
		taskInstance.setStatus(ProcessTaskInstance.STATUS_OPEN);
		taskInstance.setCreateTime(new Date());
		taskInstance.setProcessNode(context.getCurrProcessNode()
				.getProcessNodeId());
		taskInstance.setProcessInstanceId(context.getCurrProcessInstanceId());
		// 指定projectId和projectType
		Serializable projectId = (Serializable) context.getUserVariables().get(
				taskConfig.getProjectIdVar());
		String projectType = (String) context.getUserVariables().get(
				taskConfig.getProjectTypeVar());
		taskInstance.setProjectId_Internal(projectId);
		taskInstance.setProjectType(projectType);
		taskInstance.setTaskType(ProcessTaskInstance.TASK_TYPE_USER);
		taskInstance.setForkId(context.getForkId());
		// 记录parentLogId为了保证有效的日志跟踪
		taskInstance.setParentLogId_Internal(context.getParentLogId());
		// 任务分配
		assignmentTask(taskInstance, context, taskConfig);
		//任务限期处理
		if(taskConfig.getLimitInvoker()!=null){
			Object o = this.invoke(taskConfig.getLimitInvoker(), context);
			if(o!=null){
				if(o instanceof Date)
					taskInstance.limit((Date)o);
				else
					throw new RuntimeException("limitInvoker:"+taskConfig.getLimitInvoker()+" must return a Date !");
			}
		}
		// 保存任务
		this.processPersistence.saveTask(taskInstance);

		if (logger.isDebugEnabled()) {
			logger.debug("created taskInstance:" + taskInstance
					+ " with taskConfig:" + taskConfig + " with context:"
					+ context);
		}
		this.callTaskCreatedInvokerIfNecessary(taskConfig, context);
		if (this.log) {
			this.registerTaskLogIfNecessary(taskInstance, context,
					ProcessLog.EVENT_CREATE_TASK);
		}

	}