public static <T> T processTask(Task task, TaskParameters taskParameters, long timeout) {
		boolean isFirst = isFirstTask(task, taskParameters);
		TaskResult<T> result;

		if (isFirst) {
			if (LOGGER.isDebugEnabled()) {
				LOGGER.debug("Thread" + Thread.currentThread().getId() + ":当前线程是任务队列的第一个任务，将会被执行");
			}
			result = task.process(taskParameters);
			List<TaskDoneListener> currentListeners = getTaskDoneListeners(taskParameters);

			Assert.notEmpty(currentListeners, "获取任务队列失败，无法将任务完成的消息通知到队列中的其他任务");

			synchronized (currentListeners) {
				for (TaskDoneListener listener : currentListeners) {
					listener.taskDone(result);
				}
				clearListeners(taskParameters);
			}

		} else {
			if (LOGGER.isDebugEnabled()) {
				LOGGER.debug("Thread" + Thread.currentThread().getId() + ":当前线程不是任务队列的第一个任务，开始等待一个任务处理结果");
			}
			try {
				synchronized (task) {
					if (timeout > 0) {
						task.wait(timeout);
					} else {
						task.wait();
					}
				}
			} catch (InterruptedException e) {
				LOGGER.debug("等待时遇到InterruptedException", e);
			}
		}

		TaskResult<T> finalResult = task.getTaskResult();
		if (finalResult == null || !finalResult.isDone()) {
			throw new TaskNotReturnException("任务[" + task.toString() + "]结束但没有返回任何结果");
		}

		return finalResult.getResult();
	}