onStart event callback

@param Server $server
@throws \InvalidArgumentException
504085
public function onStart(Server $server)
    {
        \file_put_contents($this->serverSetting['pfile'], $server->master_pid . ',' . $server->manager_pid);

        ProcessHelper::setProcessTitle($this->serverSetting['pname'] . ' master process (' . $this->scriptFile . ')');

        $this->fireServerEvent(SwooleEvent::ON_START, [$server]);
    }
1137117
public function onWorkerStart()
    {
        if (empty($this->serverRoot)) {
            Worker::safeEcho(new \Exception('server root not set, please use WebServer::addRoot($domain, $root_path) to set server root path'));
            exit(250);
        }

        // Init mimeMap.
        $this->initMimeTypeMap();

        // Try to emit onWorkerStart callback.
        if ($this->_onWorkerStart) {
            try {
                call_user_func($this->_onWorkerStart, $this);
            } catch (\Exception $e) {
                self::log($e);
                exit(250);
            } catch (\Error $e) {
                self::log($e);
                exit(250);
            }
        }
    }
1334560
public static function workerStartApp($server, $target)
    {
        if(!static::$workerStartAppComplete)
        {
            // 触发项目的workerstart事件
            Event::trigger('IMI.MAIN_SERVER.WORKER.START.APP', [
                'server'    => $server,
                'workerID'  => static::$workerID,
            ], $target, WorkerStartEventParam::class);
            static::$workerStartAppComplete = true;
        }
    }
1327098
private function initServerCookie() {
		if(!isset($_COOKIE[self::SERVER_COOKIE]) || $_COOKIE[self::SERVER_COOKIE] != self::SERVER_PROTOCOL) {
			$isSuccess = setcookie(self::SERVER_COOKIE, self::SERVER_PROTOCOL, null, '/');
			if(!$isSuccess) {
				throw new \Exception('Unable to set PHP Console server cookie');
			}
		}
	}
924038
public static function call(Server $server, $input)
    {
        $message = self::readMessage($input);

        if ($message === null) {
            return null;
        }

        /**
         * @var string
         */
        $method = $message->method;
        /**
         * @var \stdClass
         */
        $params = $message->params;

        $result = $server->call($method, $params);

        $response = new FromObject();
        $response->appendJson('result', $result);

        return self::createMessage($response->get());
    }
784171
public function onManagerStart(Server $server): void
    {
        // $server->manager_pid;
        $this->fire(ServerEvent::MANAGER_STARTED, $server);

        // file_put_contents($this->pidFile, ',' . $server->manager_pid, FILE_APPEND);
        ServerUtil::createPidFile($server->manager_pid, $this->pidFile);
        ProcessUtil::setTitle("{$this->name}: manager");

        $this->log("The <comment>manager</comment> process success started. (PID:{$server->manager_pid})");
    }
814685
private function setStartArgs(HttpServer $httpServer)
    {
        $daemonize = \input()->getSameOpt(['d', 'daemon'], false);

        if ($daemonize) {
            $httpServer->setDaemonize();
        }
    }
1071552
public void startServer(de.uniulm.omi.cloudiator.flexiant.client.domain.Server server)
        throws FlexiantException {
        if (server == null) {
            throw new IllegalArgumentException("The given server must not be null.");
        }

        this.startServer(server.getId());
    }
346603
public function onMasterStart(SwServer $server)
    {
        // {{
        $this->setRunUser();
        $this->setProcessName('master');
        // }}

        // {{ log
        $this->get('logger')->info('启动 Master 进程', [
            'pid' => $server->master_pid
        ]);
        // }}
    }
1127803
public function beforeSend(Server $server)
    {

        // Check to make sure we have a query_port because it is required
        if (!isset($this->options[Server::SERVER_OPTIONS_QUERY_PORT])
            || empty($this->options[Server::SERVER_OPTIONS_QUERY_PORT])
        ) {
            throw new Exception(__METHOD__ . " Missing required setting '" . Server::SERVER_OPTIONS_QUERY_PORT . "'.");
        }

        // Let's loop the packets and set the proper pieces
        foreach ($this->packets as $packet_type => $packet) {
            // Update with the client port for the server
            $this->packets[$packet_type] = sprintf($packet, $server->portClient());
        }
    }
1328427
protected function onInit()
    {
        if (is_array($this->params)) {
            foreach ($this->params as $cName => $cMap) {
                $cFunc = Utility::get($cMap, "{func}");
                if (is_callable($cFunc)) {
                    $this->mapFuncs[$cName] = $cFunc;
                }

            }
        }

    }
1095580
@Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.OPTIONAL)
    protected synchronized void setServerStarted(ServerStarted serverStarted) {
        isServerStarted = true;

        // Start SystemModule if everything else is ready
        startManagementEJB();
    }
630548
public function onShutdown(Server $server): void
    {
        $this->fire(ServerEvent::SHUTDOWN, $server);

        $this->log("The swoole master process(PID: <info>{$server->master_pid})</info> stopped.");

        // self::addStat('stop_time', microtime(1));
    }
779539
public function onWorkerStart(swoole_server $server, $worker_id)
    {
        process_rename($this->getName() . ' worker');

        $this->console(sprintf('Server Worker[<info>%s</info>] is started [<info>%s</info>]', $server->worker_pid, $worker_id), OutputInterface::VERBOSITY_DEBUG);
    }
621267
public function initialize(DAV\Server $server)
    {
        $this->server = $server;
        $this->server->on('method:GET', [$this, 'httpGetEarly'], 90);
        $this->server->on('method:GET', [$this, 'httpGet'], 200);
        $this->server->on('onHTMLActionsPanel', [$this, 'htmlActionsPanel'], 200);
        if ($this->enablePost) {
            $this->server->on('method:POST', [$this, 'httpPOST']);
        }
    }
1092779
public function onStart(swoole_server $server)
    {
        if (version_compare(SWOOLE_VERSION, '1.9.5', '<')) {
            file_put_contents($this->pidFile, $server->master_pid);
            $this->pid = $server->master_pid;
        }

        process_rename($this->name . ' master');

        $this->output->writeln(sprintf("Listen: <info>%s://%s:%s</info>", $this->getScheme(), $this->getHost(), $this->getPort()));
        foreach ($this->listens as $listen) {
            $this->output->writeln(sprintf(" <info> ></info> Listen: <info>%s://%s:%s</info>", $listen->getScheme(), $listen->getHost(), $listen->getPort()));
        }

        $this->output->writeln(sprintf('PID file: <info>%s</info>, PID: <info>%s</info>', $this->pidFile, $server->master_pid));
        $this->output->writeln(sprintf('Server Master[<info>%s</info>] is started', $server->master_pid), OutputInterface::VERBOSITY_DEBUG);
    }
227836
synchronized void start(final ManagedServerBootCmdFactory factory) {
        final InternalState required = this.requiredState;
        // Ignore if the server is already started
        if(required == InternalState.SERVER_STARTED) {
            return;
        }
        // In case the server failed to start, try to start it again
        if(required != InternalState.FAILED) {
            final InternalState current = this.internalState;
            if(current != required) {
                // TODO this perhaps should wait?
                throw new IllegalStateException();
            }
        }
        operationID = CurrentOperationIdHolder.getCurrentOperationID();
        bootConfiguration = factory.createConfiguration();
        requiredState = InternalState.SERVER_STARTED;
        ROOT_LOGGER.startingServer(serverName);
        transition();
    }