Start IPC server and listens for 'done' message from child processes
@param {any} callback - callback invoked once 'done' has been emitted by each confugration
@param {any} configIndices - array indices of configuration
174189
function startWatchIPCServer(callback, configIndices) {
        ipc.config.id = serverName;
        ipc.config.retry = 3;
        ipc.config.silent = true;

        ipc.serve(
            function() {
                ipc.server.on(
                    'done',
                    watchDoneHandler.bind(this, callback, ipc, configIndices)
                );
            }
        );
        ipc.server.start();
    }
1198396
def _run_done_callbacks(self):
        ''' 
        '''
        with self._callbacks_lock:
            for callback in self._done_callbacks:
                try:
                    callback()
                # We do not want a callback interrupting the process, especially
                # in the failure cleanups. So log and catch, the excpetion.
                except Exception as ex:
                    logger.error("Exception: %s" % str(ex))
                    logger.error("Exception raised in %s." % callback, exc_info=True)

            self._done_callbacks = []
303863
function start(callback) {

  let {arc} = readArc()
  let close = x=> !x

  // if .arc has events and we're not clobbering with ARC_LOCAL flag
  if (arc.events || arc.queues) {
    // start a little web server
    let server = http.createServer(function listener(req, res) {
      let body = ''
      req.on('data', chunk => {
        body += chunk.toString()
      })
      req.on('end', () => {
        let message = JSON.parse(body)
        if (req.url === '/queues') {
          message.arcType = 'queue'
        } else if (req.url === '/events' || req.url === '/') {
          message.arcType = 'event'
        } else {
          res.statusCode = 404
          res.end('not found')
          console.log(chalk.red.dim('event bus 404 for URL ' + req.url))
          return
        }
        console.log(chalk.grey.dim('@' + message.arcType), chalk.green.dim(JSON.stringify(JSON.parse(body), null, 2)))
        // spawn a fork of the node process
        let subprocess = fork(path.join(__dirname, '_subprocess.js'))
        subprocess.send(message)
        subprocess.on('message', function _message(msg) {
          console.log(chalk.grey.dim(msg.text))
        })
        res.statusCode = 200
        res.end('ok')
      })
    })
    // ends our little web server
    close = function _closer() {
      try {
        server.close()
      }
      catch(e) {
        console.log('swallowing server.close error in sandbox events', e)
      }
    }
    // start listening on 3334
    server.listen(3334, callback ? callback: x=>!x)
  }
  else {
    callback()
  }
  return {close}
}
1264918
function doMulti(connObj, cmds, callback) {
    if (!this.isConnected()) {
      return callback(thorin.error('REDIS.NOT_CONNECTED', 'Redis connection is not ready.', 500));
    }
    if (cmds.length === 0) return callback();
    // check commands first.
    for (let i = 0; i < cmds.length; i++) {
      let cmd = cmds[i][0];
      if (typeof connObj[cmd] !== 'function') {
        return callback(thorin.error('REDIS.COMMAND_NOT_FOUND', 'Invalid redis command:' + cmd, 500));
      }
    }
    var mObj = connObj.multi();
    cmds.forEach((item) => {
      let cmd = item.splice(0, 1)[0];
      mObj[cmd].apply(mObj, item);
      item.splice(0, 0, cmd);
    });
    this[connections].default.emit('multi', cmds);
    mObj.exec((err, results) => {
      if (err) {
        return callback(thorin.error('REDIS.MULTI', 'Redis transaction encountered an error.', err, 500));
      }
      let finalResults = [];
      for (let i = 0, len = results.length; i < len; i++) {
        let t = results[i];
        if (t[0] === null) {
          finalResults.push(t[1]);
        }
      }
      callback(null, finalResults);
    });
  }
1296587
function tsc(projectPath, done) {
  const path = require('path');
  const platformScriptPath = require('./platform-script-path');
  const childProcess = require('child_process');

  childProcess
      .spawn(
          path.join(__dirname, platformScriptPath('../../node_modules/.bin/tsc')),
          ['-p', path.join(__dirname, '../..', projectPath)], {stdio: 'inherit'})
      .on('close', done);
}
1191568
public static void callOnIsIntermediateResultExpectedChanged(
      @Nullable List<ProducerContextCallbacks> callbacks) {
    if (callbacks == null) {
      return;
    }
    for (ProducerContextCallbacks callback : callbacks) {
      callback.onIsIntermediateResultExpectedChanged();
    }
  }
1000857
public void listen(InetAddress localEp) throws ConfigurationException
    {
        callbacks.reset(); // hack to allow tests to stop/restart MS
        for (ServerSocket ss : getServerSockets(localEp))
        {
            SocketThread th = new SocketThread(ss, "ACCEPT-" + localEp);
            th.start();
            socketThreads.add(th);
        }
        listenGate.signalAll();
    }
44338
function () {
			waitForServers--;
			if (waitForServers) return;
			if (seminarjs.get('logger')) {
				console.log(dashes + startupMessages.join('\n') + dashes);
			}
			events.onStart && events.onStart();
		}
1023185
function(config) {
  /**
   * Local event emitter instance to handle the PS.
   * @type {Emitter}
   */
   
  this.events = new Emitter();

  /**
   * Format string for formatting the output to a string.
   * @type {string}
   */
   
  this.format = config.format || '';

  /**
   * Update interval.
   * @type {number}
   * @default 1000
   */
   
  this.interval = config.interval || 1000;

  /**
   * Reference to the monitor loop interval.
   * @type {function}
   */
   
  this.intervalId = null;

  /**
   * Value indicating whether the monitor loop has been started.
   * @type {Boolean}
   */
   
  this.isRunning = false;

  /**
   * Process IDs to monitor.
   * @type {array}
   */
   
  this.pid = config.pid;

  /**
   * The technique used to find CPU usage.
   * @type {string}
   */

  this.technique = 'ps';
  if(config.technique === 'proc') {
    this.technique = 'proc';
  }

  /**
   * Process statistics detail.
   * @type {object}
   */
   
  this.stats = {};
}
888264
function (server, callback) {
            var self = this;

            this.$server = server;
            this._start(function(err) {
                self.$started = true;
                callback(err);
            });
        }
1052743
function run (config, done) {
  config = config || {}

  logger.setupFromConfig(config)

  done = helper.isFunction(done) ? done : process.exit
  config = cfg.parseConfig(config.configFile, config)

  let exitCode = 1
  const options = {
    hostname: config.hostname,
    path: config.urlRoot + 'run',
    port: config.port,
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    }
  }

  const request = http.request(options, function (response) {
    response.on('data', function (buffer) {
      const parsedResult = parseExitCode(buffer, exitCode, config.failOnEmptyTestSuite)
      exitCode = parsedResult.exitCode
      process.stdout.write(parsedResult.buffer)
    })

    response.on('end', () => done(exitCode))
  })

  request.on('error', function (e) {
    if (e.code === 'ECONNREFUSED') {
      log.error('There is no server listening on port %d', options.port)
      done(1, e.code)
    } else {
      throw e
    }
  })

  request.end(JSON.stringify({
    args: config.clientArgs,
    removedFiles: config.removedFiles,
    changedFiles: config.changedFiles,
    addedFiles: config.addedFiles,
    refresh: config.refresh,
    colors: config.colors
  }))
}
246767
function init(msg, done) {
  var config = {
    context: opts.context,
    adapter: opts.adapter,
    routes: opts.routes,
    auth: opts.auth,
    options: opts.options
  }

  setServer.call(this, config, done)
}
910512
private void initDispatcherThreads(Feature.AsynchronousMessageDispatch configuration) {
        for (int i = 0; i < configuration.getNumberOfMessageDispatchers(); i++) {
            // each thread will run forever and process incoming
            // message publication requests
            Thread dispatcher = configuration.getDispatcherThreadFactory().newThread(new Runnable() {
                public void run() {
                    while (true) {
                        IMessagePublication publication = null;
                        try {
                            publication = pendingMessages.take();
                            publication.execute();
                        } catch (InterruptedException e) {
                            Thread.currentThread().interrupt();
                            return;
                        } catch(Throwable t){
                            handlePublicationError(new InternalPublicationError(t, "Error in asynchronous dispatch",publication));
                        }
                    }
                }
            });
            dispatcher.setName("MsgDispatcher-"+i);
            dispatchers.add(dispatcher);
            dispatcher.start();
        }
    }
1257190
function startSkeletonApplication(options) {
  debug('Starting to create application skeleton');
  const configWithDefaults = defaults(
    options, {
      redirects: {
        'documentation-from-root': {
          match: /^\/$/,
          target: '/docs',
        },
      },
      ioc: {
      },
      customMiddleware: {
        beforeSwagger: [],
        afterSwagger: [],
        beforeController: [],
      },
      codegen: {
        controllerStubFolder: 'controllers',
        temporaryDirectory: './.temp',
        templateSet: templates,
      },
      service: {
        listenPort: 10010,
      },
      cors: {
      },
    });

  // If the swagger input is a string, then load it as a filename
  const swaggerFile = configWithDefaults.service.swagger;
  const swagger = typeof swaggerFile === 'string' ?
    yamljs.load(swaggerFile) : swaggerFile;

  // Create service instances
  const app = connect();
  const ioc = connectIoc(configWithDefaults.ioc);

  // Generate custom application code
  generateApplicationCode(
    swagger,
    configWithDefaults.codegen);

  initializeSwagger(swagger, (middleware) => {
    // Pre-request handling middleware
    app.use(query());                                    // Query-string parsing
    app.use(fiddleware.respondJson());                   // res.json(data, status) support.
    app.use(ioc.middleware);                             // Somersault IoC for controllers.
    app.use(cors(configWithDefaults.cors));              // Cross-origin
    app.use(cookieParser());
    // Custom middleware
    for (const item of configWithDefaults.customMiddleware.beforeSwagger) {
      app.use(item);
    }

    // Swagger-tools middleware
    app.use(middleware.swaggerMetadata());
    app.use(middleware.swaggerValidator());

    for (const item of configWithDefaults.customMiddleware.beforeController) {
      app.use(item);
    }

    app.use(middleware.swaggerRouter({
      controllers: path.join(
        configWithDefaults.codegen.temporaryDirectory,
        configWithDefaults.codegen.controllerStubFolder),
    }));
    app.use(middleware.swaggerUi());

    // Post-request handling middleware
    app.use(redirect(configWithDefaults.redirects));      // Redirect / to /docs

    // Custom middleware
    for (const item of configWithDefaults.customMiddleware.afterSwagger) {
      app.use(item);
    }

    app.use(errorHandler());                              // When there's an exception.

    const server = app.listen(configWithDefaults.service.listenPort);
    app.close = function closeServer() {
      server.close();
    };
  });

  return app;
}
1088624
function(options){
    this.triggerMethod("initialize:before", options);
    this._initCallbacks.run(options, this);
    this.triggerMethod("initialize:after", options);

    this.triggerMethod("start", options);
  }
1351955
function restartOnProcess( index ) {
  log( 'Attempting to restart ' + index + '...' );

  // generate delegate function to pass with proper contexts.
  var startRequest = (function(context, index) {
    return function(cb) {
        startForeverWithIndex.call(context, index, cb);
    };
  }(this, index));

  done = this.async();
  findProcessWithIndex( index, function(process) {
    if(typeof process !== 'undefined') {
      log(forever.format(true,[process]));
      forever.restart(index, false);
      done();
    }
    else {
      log(index + ' not found in list of processes in forever. Starting new instance...');
      startRequest(done);
    }
  });
}
217122
def start(self, on_exit_callback=None):
        
        # TODO: Support params for services by mapping {servicename: {class,
        # params}}?
        for service in self.services.keys():
            self.services[service] = self.services[service]()

        self.server.start(on_exit_callback)