log.info("Task is marked as \"" + ITaskInstance.STATE_AWAITINGCOMPLETE
log.info("Task is marked as " + friendlyState(taskInstance)
	private void runTask(ITaskInstance taskInstance)			throws DefinitionNotFoundException, TaskConstructException, ClassInstantiationException, RunTaskException, StateFailureException {		if (log.isInfoEnabled()) {			log					.info("Running TaskInstance "							+ taskInstance);		}		if (taskInstance.getState() == ITaskInstance.STATE_AWAITINGCOMPLETE) {			if (log.isInfoEnabled()) {				log.info("Task is marked as \""						+ ITaskInstance.STATE_AWAITINGCOMPLETE						+ "\" so no further transitions needed");			}			return;		}		ITaskDefinition taskDef = taskInstance.getTaskDefinition();		if (taskDef.isSynchronised()) {			// check for blocks			if (taskSync.isTaskBlocked(taskInstance)) {				if (log.isInfoEnabled()) {					log.info("Task " + taskInstance							+ " is blocked and will not be run");				}				return;			}			// task not locked, so set the state to "ready"			if (log.isInfoEnabled()) {				log.info("Task " + taskInstance						+ " is NOT blocked and will be run");			}			taskInstance.setState(ITaskInstance.STATE_READY);		}		if (taskInstance.getState() == ITaskInstance.STATE_AWAITINGINITIALISATION) {			try {				doTaskConstruct(taskInstance);			} catch (Exception e) {				String emsg = "Failure to initialise Task "						+ taskInstance;				log.error(emsg, e);				throw new TaskConstructException(emsg, e);			}		}		if (taskInstance.getState() != ITaskInstance.STATE_READY) {			throw new TaskConstructException("Task State is not set to '"					+ ITaskInstance.STATE_READY					+ "' after TaskConstructor called and cannot be transitioned further");		}		String runClass = taskDef.getClassName();		// check to see if task has a class associated with it		if (runClass != null) {			if (log.isInfoEnabled()) {				log.info("Attempting to instance TaskAction class " + runClass);			}			// create instance of the class specified in ClassName			ITaskAction taskClass;			try {				ITransaction t = stateFactory.beginTransaction();				taskInstance.setState(ITaskInstance.STATE_RUNNING);				stateFactory.saveObject(taskInstance);				t.commit();				taskClass = classFactory.getTaskAction(runClass);			} catch (Exception e) {				// fail this transistion if we cant instantiate the task action				log.error("Failed to instantiate Task Action " + runClass, e);				throw new ClassInstantiationException(e);			}			try {				// fail this transistion if the task action generates an				// exception				taskClass.runTask(taskInstance);			} catch (RunTaskException e) {				log.error("Problem running task " + runClass, e);				throw new RunTaskException("Problem running Task Action "						+ runClass, e);			}		} else {			// arbitrarily set the status of the task to "complete"			try {				ITransaction t = stateFactory.beginTransaction();				taskInstance.setState(ITaskInstance.STATE_AWAITINGCOMPLETE);				stateFactory.saveObject(taskInstance);				t.commit();			} catch (StateFailureException e) {				String emsg = "Failed to set task completion";				log.error(emsg, e);				throw new StateFailureException(emsg, e);			}		}	}