private void runWithPermit(final Task<?> task, final String planClass) {
    ArgumentUtil.requireNotNull(task, "task");
    ArgumentUtil.requireNotNull(planClass, "planClass");
    State currState, newState;
    do {
      currState = _stateRef.get();
      if (currState._stateName != StateName.RUN) {
        task.cancel(new EngineShutdownException("Task submitted after engine shutdown"));
        return;
      }
      newState = new State(StateName.RUN, currState._pendingCount + 1);
    } while (!_stateRef.compareAndSet(currState, newState));

    PlanContext planContext = new PlanContext(this, _taskExecutor, _timerExecutor, _loggerFactory, _allLogger,
        _rootLogger, planClass, task, _maxRelationshipsPerTrace, _planDeactivationListener, _planCompletionListener,
        _taskQueueFactory.newTaskQueue(), _drainSerialExecutorQueue, _executionMonitor);
    new ContextImpl(planContext, task).runTask();
  }
private void runWithPermit(final Task<?> task, final String planClass) {
    ArgumentUtil.requireNotNull(task, "task");
    ArgumentUtil.requireNotNull(planClass, "planClass");
    State currState, newState;
    do {
      currState = _stateRef.get();
      if (currState._stateName != StateName.RUN) {
        task.cancel(new EngineShutdownException("Task submitted after engine shutdown"));
        return;
      }
      newState = new State(StateName.RUN, currState._pendingCount + 1);
    } while (!_stateRef.compareAndSet(currState, newState));

    PlanContext planContext = new PlanContext(this, _taskExecutor, _timerExecutor, _loggerFactory, _allLogger,
        _rootLogger, planClass, task, _maxRelationshipsPerTrace, _planDeactivationListener, _planCompletionListener,
        _taskQueueFactory.newTaskQueue(), _drainSerialExecutorQueue, _executionMonitor);
    new ContextImpl(planContext, task).runTask();
  }
private void runWithPermit ( final Task < ? > task , final String planClass ) { ArgumentUtil . requireNotNull ( task , "task" ) ; ArgumentUtil . requireNotNull ( planClass , "planClass" ) ; State currState , newState ; do { currState = _stateRef . get ( ) ; if ( currState . _stateName != StateName . RUN ) { task . cancel ( new EngineShutdownException ( "Task submitted after engine shutdown" ) ) ; return ; } newState = new State ( StateName . RUN , currState . _pendingCount + 1 ) ; } while ( ! _stateRef . compareAndSet ( currState , newState ) ) ; PlanContext planContext = new PlanContext ( this , _taskExecutor , _timerExecutor , _loggerFactory , _allLogger , _rootLogger , planClass , task , _maxRelationshipsPerTrace , _planDeactivationListener , _planCompletionListener , _taskQueueFactory . newTaskQueue ( ) , _drainSerialExecutorQueue , _executionMonitor ) ; new ContextImpl ( planContext , task ) . runTask ( ) ; }
Runs the given task with its own context. Use {@code Tasks.seq} and
{@code Tasks.par} to create and run composite tasks.

@param task the task to run
Runs the given task with its own context . Use { @code Tasks . seq } and { @code Tasks . par } to create and run composite tasks .