Immediately after the connection is first established, execute all the commands in this.m_startupCommands.
This method concatenates the commands of all those given in the array and attempts to execute them
in a single round-trip call.
328284
void executeStartupCommands() {
		  if (m_startupCommands !=null) {
			  StringBuilder sb = new StringBuilder();
			  for (IAgentCommand cmd : m_startupCommands) {
				  sb.append(cmd.getMessage());
			  }
			  getControlThread().sendMessage(sb.toString());
		  }
		  
	  }
339018
def start(self):
        ''''''
        assert self._client is None

        logger.debug('IsolationContext[%d] starting', id(self))

        # Create the queues
        request_queue = multiprocessing.Queue()
        response_queue = multiprocessing.Queue()

        # Launch the server process
        server = Server(request_queue, response_queue)  # Do not keep a reference to this object!
        server_process = multiprocessing.Process(target=server.loop)
        server_process.start()

        # Create a client to talk to the server
        self._client = Client(server_process, request_queue, response_queue)
1330263
protected void doExecuteCommand() {
        if (this.commandExecutor instanceof ParameterizableActionCommandExecutor) {
            ((ParameterizableActionCommandExecutor) this.commandExecutor).execute(getParameters());
        }
        else {
        	if (this.commandExecutor != null) {
        		this.commandExecutor.execute();
        	}
        }
    }
1329851
public void addStartCommand() {
        StringBuilder buf = new StringBuilder();
        buf.append("(start)");
        fifo.add(fifo.size(), buf.toString());
    }
1152143
def exec(*commands)
      ret = ''
      commands.each { |cmd| ret += shell.exec(cmd) }
      ret + shell.exec('exec')
    end
902448
def start_exec(command, options)
      all_args = command.args
      all_args << options
      self.send(command.name, *all_args)
    end
1069704
public void process(Map<String, String> options) {
        Log.info("Initializing Commands...");
        for (Map.Entry<String, String> entry : options.entrySet()) {
            AbstractCommand command = PreConfigurationContext.getCommandByName(entry.getKey());
            if (null != command) {
                command.setCommands(options);
                try {
                    command.init();
                } catch (InitializationException e) {
                    Log.error("There is a problem in the option you configured: ", entry.getKey(),
                            ErrorGuide.getGuide(ErrorGuide.OPTION_ERROR));
                }
                command.execute();
                command.stop();
            }
            Log.info(entry.getKey() + " Command Initialized.");
        }
    }
1298754
public void execute() throws BuildException {
    if (null == cmd)
      throw new BuildException("Missing command (cmd) argument");
    argv.add(0, cmd);

    if (null == confloader) {
      setConf(getProject().getProperty("hadoop.conf.dir"));
    }

    int exit_code = 0;
    try {
      pushContext();

      Configuration conf = new Configuration();
      conf.setClassLoader(confloader);
      exit_code = ToolRunner.run(conf, shell,
          argv.toArray(new String[argv.size()]));
      exit_code = postCmd(exit_code);

      if (0 > exit_code) {
        StringBuilder msg = new StringBuilder();
        for (String s : argv)
          msg.append(s + " ");
        msg.append("failed: " + exit_code);
        throw new Exception(msg.toString());
      }
    } catch (Exception e) {
      if (failonerror)
          throw new BuildException(e);
    } finally {
      popContext();
    }
  }
740102
private void startConnection()
  {
    while (doStart()) {
      boolean isValid = false;

      try {
        long now = currentTimeActual();

        updateIdleExpireTime(now);

        int id = _gId.incrementAndGet();
        
        updateThrottle();

        /*
        if (id == 200) {
          ThreadDump.create().dumpThreads();
        }
        else */ 
        /*
        if (id == 1000) {
          ThreadDump.create().dumpThreads();
        }
        */

        launchChildThread(id);
        
        isValid = true;
      } finally {
        if (! isValid) {
          onStartFail();
        }
      }
    }
  }
1242267
public function run()
    {
        // Add registered command to console 
        foreach ($this->commands as $command) {
            $this->consoleApp->add($command);
        }

        $this->consoleApp->run();
    }
1078136
void markCommandStart(HystrixCommandKey commandKey, HystrixThreadPoolKey threadPoolKey, HystrixCommandProperties.ExecutionIsolationStrategy isolationStrategy) {
        int currentCount = concurrentExecutionCount.incrementAndGet();
        HystrixThreadEventStream.getInstance().commandExecutionStarted(commandKey, threadPoolKey, isolationStrategy, currentCount);
    }
414214
def execute(command, params={})
      unless params[:dry_run]
        if params[:return]
          System.execute(command, :return => true)
        else
          $stdout.puts
          System.execute(command)
        end
      end
    end
473341
function _initializeCommands(session, callback, _commands) {
    _commands = _commands || _.values(session.commands().all());
    if (_.isEmpty(_commands)) {
        return callback();
    }

    // Get the next command to initialize
    var command = _commands.pop();
    if (!_.isFunction(command.init)) {
        // If it does not have the optional init function we just skip it
        return _initializeCommands(session, callback, _commands);
    }

    // Initialize the command
    command.init(session, function(err) {
        if (err) {
            return callback(err);
        }

        // Recursively move on to the next command
        return _initializeCommands(session, callback, _commands);
    });
}
109511
public static void main(String args[]) {
        // Associate a new Context with this thread
        Context cx = Context.enter();
        try {
            // Initialize the standard objects (Object, Function, etc.)
            // This must be done before scripts can be executed.
            Shell shell = new Shell();
            cx.initStandardObjects(shell);

            // Define some global functions particular to the shell. Note
            // that these functions are not part of ECMA.
            String[] names = { "print", "quit", "version", "load", "help" };
            shell.defineFunctionProperties(names, Shell.class,
                                           ScriptableObject.DONTENUM);

            args = processOptions(cx, args);

            // Set up "arguments" in the global scope to contain the command
            // line arguments after the name of the script to execute
            Object[] array;
            if (args.length == 0) {
                array = new Object[0];
            } else {
                int length = args.length - 1;
                array = new Object[length];
                System.arraycopy(args, 1, array, 0, length);
            }
            Scriptable argsObj = cx.newArray(shell, array);
            shell.defineProperty("arguments", argsObj,
                                 ScriptableObject.DONTENUM);

            shell.processSource(cx, args.length == 0 ? null : args[0]);
        } finally {
            Context.exit();
        }
    }
1032147
def runCommands(self,commands,args):
        
        errorCounter = 0
        if args.list:
            print '\n'.join(commands)
        else:
            # Each command is executed sequentially:
            for command in commands:
                process = subprocess.Popen(command, stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True)
                stream = process.communicate()
                output = stream[0]
                erroroutput = stream[1]
                returncode = process.returncode
                if args.verbose:
                    print 'Executing command: '+command
                if returncode != 0:
                    errorCounter = errorCounter + 1
                    if args.verbose or not args.ignore_errors:
                        print 'An error occurred:\n'
                        print erroroutput
                    if not args.ignore_errors:
                        print('Terminating map process.')
                        break
                if returncode == 0 and len(output) > 0:
                    sys.stdout.write(output)
        if args.verbose:
            print 'Process completed successfully.'
            if errorCounter > 0:
                if errorCounter > 1:
                    print str(errorCounter) + ' errors occurred during the process.'
                else:
                    print str(errorCounter) + ' error occurred during the process.'
506336
public function runApplication()
    {
        $application = $this->createNew(SymfonyApplication::class, $this->getName());
        foreach ($this->commands as $commandClass) {
            $command = $this->createNew($commandClass);
            $application->add($command);
            if ($command instanceof Command && $command->isDefaultCommand()) {            
                $application->setDefaultCommand($command->getName());
            }
        }        
        $application->run();
    }
1155217
public void run(){
		while(true){
			String cmd = null;
			try {
				cmd = commandQueue.take();
			} catch (InterruptedException e) {
				continue;
			}
			if ("exit".equals(cmd)){
				log.info("CamelContextController for '" + context.getName() + "' received '" + cmd + "' command.");
				break;
			}
			log.info("CamelContext '" + context.getName() + "' received '" + cmd + "' command.");
			try {
				context.getClass().getMethod(cmd).invoke(context);
				log.info("CamelContext '" + context.getName() + "' successfully proccessed '" + cmd + "' command.");
			}catch(Exception e){
				log.error("CamelContext '" + context.getName() + "' failed processing '" + cmd + "' command.", e);
			}
		}
		try {
			myContext.stop();
			log.info("CamelContextController for '" + context.getName() + "' will exit.");
		} catch (Exception e) {
			log.error("Error stopping CamelContextController's own CamelContext '" + myContext.getName() + "'.", e);
		}
	}