docs: @VisibleForTesting
    protected void startExecutorMonitor(final int container,
                                        final Process containerExecutor,
                                        Set<PackingPlan.InstancePlan> instances) {
      // add the container for monitoring
      Runnable r = new Runnable() {
        @Override
        public void run() {
          try {
            LOG.info("Waiting for container " + container + " to finish.");
            containerExecutor.waitFor();
  
            LOG.log(Level.INFO,
                "Container {0} is completed. Exit status: {1}",
                new Object[]{container, containerExecutor.exitValue()});
            if (isTopologyKilled) {
              LOG.info("Topology is killed. Not to start new executors.");
              return;
            } else if (!processToContainer.containsKey(containerExecutor)) {
              LOG.log(Level.INFO, "Container {0} is killed. No need to relaunch.", container);
              return;
            }
            LOG.log(Level.INFO, "Trying to restart container {0}", container);
            // restart the container
            startExecutor(processToContainer.remove(containerExecutor), instances);
          } catch (InterruptedException e) {
            if (!isTopologyKilled) {
              LOG.log(Level.SEVERE, "Process is interrupted: ", e);
            }
          }
        }
      };
  
      monitorService.submit(r);
    }