test_class.file: rocket-core/src/test/java/cn/hikyson/rocket/task/TaskScheduerTest.java
test_class.identifier: TaskScheduerTest
test_case.body: @Test
      public void schedule3() throws Exception {
          final Executor executor = Executors.newCachedThreadPool();
          final CountDownLatch downLatch = new CountDownLatch(3);
          final long[] taskStartTime = {0, 0, 0};
          final long[] taskEndTime = {0, 0, 0};
          LaunchTask task0 = TaskFactory.create("task0", 1000, new ArrayList<String>(), executor, new TestTaskCallback() {
              @Override
              public void taskStart() {
                  taskStartTime[0] = System.nanoTime();
              }
  
              @Override
              public void taskEnd() {
                  taskEndTime[0] = System.nanoTime();
                  downLatch.countDown();
              }
          });
          LaunchTask task1 = TaskFactory.create("task1", 1000, Collections.singletonList("task0"), executor, new TestTaskCallback() {
              @Override
              public void taskStart() {
                  taskStartTime[1] = System.nanoTime();
              }
  
              @Override
              public void taskEnd() {
                  taskEndTime[1] = System.nanoTime();
                  downLatch.countDown();
              }
          });
          LaunchTask task2 = TaskFactory.create("task2", 1000, Arrays.asList("task0", "task1"), executor, new TestTaskCallback() {
              @Override
              public void taskStart() {
                  taskStartTime[2] = System.nanoTime();
              }
  
              @Override
              public void taskEnd() {
                  taskEndTime[2] = System.nanoTime();
                  downLatch.countDown();
              }
          });
          new TaskScheduer(Arrays.asList(task2, task1, task0)).schedule(null, 0, null);
          downLatch.await();
          //1 依赖 0 ,2 依赖 1 ,2 依赖0
          Assert.assertTrue(taskEndTime[0] < taskStartTime[1]);
          Assert.assertTrue(taskEndTime[1] < taskStartTime[2]);
      }
test_case.class_method_signature: TaskScheduerTest.schedule3()
test_case.full_signature: @Test public void schedule3()
test_case.identifier: schedule3
test_case.invocations: newCachedThreadPool create nanoTime nanoTime countDown create singletonList nanoTime nanoTime countDown create asList nanoTime nanoTime countDown schedule asList await assertTrue assertTrue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void schedule3()
focal_class.declarator: mTasks
focal_class.modifier: private
focal_class.original_string: private List<LaunchTask> mTasks;
focal_class.type: List<LaunchTask>
focal_class.var_name: mTasks
focal_class.file: rocket-core/src/main/java/cn/hikyson/rocket/task/TaskScheduer.java
focal_class.identifier: TaskScheduer
focal_class.class_method_signature: TaskScheduer.TaskScheduer(List<LaunchTask> originTasks)
focal_class.full_signature: public  TaskScheduer(List<LaunchTask> originTasks)
focal_class.identifier: TaskScheduer
focal_class.modifiers: public
focal_class.parameters: (List<LaunchTask> originTasks)
focal_class.signature:  TaskScheduer(List<LaunchTask> originTasks)
focal_class.class_method_signature: TaskScheduer.schedule(final IErrorHandler iErrorHandler, long timeout, ITimeoutHandler iTimeoutHandler, final ITasksFinishCallback iTasksFinishCallback)
focal_class.full_signature: public void schedule(final IErrorHandler iErrorHandler, long timeout, ITimeoutHandler iTimeoutHandler, final ITasksFinishCallback iTasksFinishCallback)
focal_class.identifier: schedule
focal_class.modifiers: public
focal_class.parameters: (final IErrorHandler iErrorHandler, long timeout, ITimeoutHandler iTimeoutHandler, final ITasksFinishCallback iTasksFinishCallback)
focal_class.return: void
focal_class.signature: void schedule(final IErrorHandler iErrorHandler, long timeout, ITimeoutHandler iTimeoutHandler, final ITasksFinishCallback iTasksFinishCallback)
focal_class.class_method_signature: TaskScheduer.topologicalSort(List<LaunchTask> originTasks)
focal_class.full_signature: private synchronized List<LaunchTask> topologicalSort(List<LaunchTask> originTasks)
focal_class.identifier: topologicalSort
focal_class.modifiers: private synchronized
focal_class.parameters: (List<LaunchTask> originTasks)
focal_class.return: List<LaunchTask>
focal_class.signature: List<LaunchTask> topologicalSort(List<LaunchTask> originTasks)
focal_class.class_method_signature: TaskScheduer.getIndexOfTask(List<LaunchTask> originTasks, String taskName)
focal_class.full_signature: private int getIndexOfTask(List<LaunchTask> originTasks, String taskName)
focal_class.identifier: getIndexOfTask
focal_class.modifiers: private
focal_class.parameters: (List<LaunchTask> originTasks, String taskName)
focal_class.return: int
focal_class.signature: int getIndexOfTask(List<LaunchTask> originTasks, String taskName)
focal_method.body: public void schedule(final IErrorHandler iErrorHandler, long timeout, ITimeoutHandler iTimeoutHandler, final ITasksFinishCallback iTasksFinishCallback) {
          final AtomicInteger taskDoneCounter = new AtomicInteger(0);
          final int taskCount = mTasks.size();
          for (final LaunchTask task : mTasks) {
              task.runOn().execute(new Worker(iErrorHandler, task, mTasks, new Worker.TaskDoneCallback() {
                  @Override
                  public void onTaskDone() {
                      if (taskDoneCounter.addAndGet(1) == taskCount && iTasksFinishCallback != null) {
                          iTasksFinishCallback.onTasksFinished();
                      }
                  }
              }));
          }
          TaskDelayChecker.delayCheckTaskAlive(mTasks, timeout, iTimeoutHandler);
      }
focal_method.class_method_signature: TaskScheduer.schedule(final IErrorHandler iErrorHandler, long timeout, ITimeoutHandler iTimeoutHandler, final ITasksFinishCallback iTasksFinishCallback)
focal_method.full_signature: public void schedule(final IErrorHandler iErrorHandler, long timeout, ITimeoutHandler iTimeoutHandler, final ITasksFinishCallback iTasksFinishCallback)
focal_method.identifier: schedule
focal_method.invocations: size execute runOn addAndGet onTasksFinished delayCheckTaskAlive
focal_method.modifiers: public
focal_method.parameters: (final IErrorHandler iErrorHandler, long timeout, ITimeoutHandler iTimeoutHandler, final ITasksFinishCallback iTasksFinishCallback)
focal_method.return: void
focal_method.signature: void schedule(final IErrorHandler iErrorHandler, long timeout, ITimeoutHandler iTimeoutHandler, final ITasksFinishCallback iTasksFinishCallback)