@Override
  public final void contextRun(final Context context,
                               final TaskLogger taskLogger,
                               final Task<?> parent,
                               final Collection<Task<?>> predecessors)
  {
    if (transitionRun())
    {
      final Promise<T> promise;
      try
      {
        if (parent != null)
        {
          _relationshipBuilder.addRelationship(Relationship.CHILD_OF, parent);
        }
        _relationshipBuilder.addRelationship(Relationship.SUCCESSOR_OF, predecessors);

        taskLogger.logTaskStart(this);
        try
        {
          promise = doContextRun(context);
        }
        finally
        {
          transitionPending();
        }

        promise.addListener(new PromiseListener<T>()
        {
          @Override
          public void onResolved(Promise<T> resolvedPromise)
          {
            if (promise.isFailed())
            {
              fail(promise.getError() , taskLogger);
            }
            else
            {
              done(promise.get(), taskLogger);
            }
          }
        });
      }
      catch (Throwable t)
      {
        fail(t, taskLogger);
      }
    }
    else
    {
      if (parent != null)
      {
        _relationshipBuilder.addRelationship(Relationship.POTENTIAL_CHILD_OF, parent);
      }
      _relationshipBuilder.addRelationship(Relationship.POSSIBLE_SUCCESSOR_OF, predecessors);
    }
  }