test_class.file: smart-engine/src/test/java/org/smartdata/server/engine/cmdlet/TestCmdletExecutor.java
test_class.identifier: TestCmdletExecutor
test_case.body: @Test
    public void testCmdletExecutor() throws InterruptedException {
      final List<StatusMessage> statusMessages = new ArrayList<>();
      StatusReporter reporter =
          new StatusReporter() {
            @Override
            public void report(StatusMessage status) {
              statusMessages.add(status);
            }
          };
      CmdletExecutor executor = new CmdletExecutor(new SmartConf());
      StatusReportTask statusReportTask = new StatusReportTask(reporter, executor, new SmartConf());
      ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
      executorService.scheduleAtFixedRate(
              statusReportTask, 100, 10, TimeUnit.MILLISECONDS);
      SmartAction action = new EchoAction();
      Map<String, String> args = new HashMap<>();
      args.put(EchoAction.PRINT_MESSAGE, "message success");
      action.setArguments(args);
      action.setActionId(101);
      Cmdlet cmdlet = new Cmdlet(Arrays.asList(action));
  
      executor.execute(cmdlet);
  
      Thread.sleep(2000);
  
      StatusReport lastReport = (StatusReport) statusMessages.get(statusMessages.size() - 1);
      ActionStatus status = lastReport.getActionStatuses().get(0);
      Assert.assertTrue(status.isFinished());
      Assert.assertNull(status.getThrowable());
  
      executor.shutdown();
    }
test_case.class_method_signature: TestCmdletExecutor.testCmdletExecutor()
test_case.full_signature: @Test public void testCmdletExecutor()
test_case.identifier: testCmdletExecutor
test_case.invocations: add newSingleThreadScheduledExecutor scheduleAtFixedRate put setArguments setActionId asList execute sleep get size get getActionStatuses assertTrue isFinished assertNull getThrowable shutdown
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCmdletExecutor()
focal_class.declarator: LOG = LoggerFactory.getLogger(CmdletExecutor.class)
focal_class.modifier: static final
focal_class.original_string: static final Logger LOG = LoggerFactory.getLogger(CmdletExecutor.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: smartConf
focal_class.modifier: private final
focal_class.original_string: private final SmartConf smartConf;
focal_class.type: SmartConf
focal_class.var_name: smartConf
focal_class.declarator: listenableFutures
focal_class.modifier: private
focal_class.original_string: private Map<Long, Future> listenableFutures;
focal_class.type: Map<Long, Future>
focal_class.var_name: listenableFutures
focal_class.declarator: runningCmdlets
focal_class.modifier: private
focal_class.original_string: private Map<Long, Cmdlet> runningCmdlets;
focal_class.type: Map<Long, Cmdlet>
focal_class.var_name: runningCmdlets
focal_class.declarator: idToReportCmdlet
focal_class.modifier: private
focal_class.original_string: private Map<Long, Cmdlet> idToReportCmdlet;
focal_class.type: Map<Long, Cmdlet>
focal_class.var_name: idToReportCmdlet
focal_class.declarator: executorService
focal_class.modifier: private
focal_class.original_string: private ListeningExecutorService executorService;
focal_class.type: ListeningExecutorService
focal_class.var_name: executorService
focal_class.file: smart-engine/src/main/java/org/smartdata/server/engine/cmdlet/CmdletExecutor.java
focal_class.identifier: CmdletExecutor
focal_class.class_method_signature: CmdletExecutor.CmdletExecutor(SmartConf smartConf)
focal_class.full_signature: public  CmdletExecutor(SmartConf smartConf)
focal_class.identifier: CmdletExecutor
focal_class.modifiers: public
focal_class.parameters: (SmartConf smartConf)
focal_class.signature:  CmdletExecutor(SmartConf smartConf)
focal_class.class_method_signature: CmdletExecutor.execute(Cmdlet cmdlet)
focal_class.full_signature: public void execute(Cmdlet cmdlet)
focal_class.identifier: execute
focal_class.modifiers: public
focal_class.parameters: (Cmdlet cmdlet)
focal_class.return: void
focal_class.signature: void execute(Cmdlet cmdlet)
focal_class.class_method_signature: CmdletExecutor.stop(Long cmdletId)
focal_class.full_signature: public void stop(Long cmdletId)
focal_class.identifier: stop
focal_class.modifiers: public
focal_class.parameters: (Long cmdletId)
focal_class.return: void
focal_class.signature: void stop(Long cmdletId)
focal_class.class_method_signature: CmdletExecutor.shutdown()
focal_class.full_signature: public void shutdown()
focal_class.identifier: shutdown
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void shutdown()
focal_class.class_method_signature: CmdletExecutor.getStatusReport()
focal_class.full_signature: public StatusReport getStatusReport()
focal_class.identifier: getStatusReport
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: StatusReport
focal_class.signature: StatusReport getStatusReport()
focal_class.class_method_signature: CmdletExecutor.removeCmdlet(long cmdletId)
focal_class.full_signature: private void removeCmdlet(long cmdletId)
focal_class.identifier: removeCmdlet
focal_class.modifiers: private
focal_class.parameters: (long cmdletId)
focal_class.return: void
focal_class.signature: void removeCmdlet(long cmdletId)
focal_method.body: public CmdletExecutor(SmartConf smartConf) {
      this.smartConf = smartConf;
      this.listenableFutures = new ConcurrentHashMap<>();
      this.runningCmdlets = new ConcurrentHashMap<>();
      this.idToReportCmdlet = new ConcurrentHashMap<>();
      int nThreads =
          smartConf.getInt(
              SmartConfKeys.SMART_CMDLET_EXECUTORS_KEY,
              SmartConfKeys.SMART_CMDLET_EXECUTORS_DEFAULT);
      this.executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(nThreads));
    }
focal_method.class_method_signature: CmdletExecutor.CmdletExecutor(SmartConf smartConf)
focal_method.full_signature: public  CmdletExecutor(SmartConf smartConf)
focal_method.identifier: CmdletExecutor
focal_method.modifiers: public
focal_method.parameters: (SmartConf smartConf)
focal_method.signature:  CmdletExecutor(SmartConf smartConf)