Encapsulates the state of the server.
543446
function ServerState() {

  // server configuration
  this._conf = new Configuration();
  this._conf.once('load', this.onConfigLoad.bind(this));

  // the server bind address information
  // if listen() is never called this is null
  this._addr = null;

  // timestamp for the last save of the rdb file
  this._lastsave = Date.now();

  // server logger
  this._logger = logger();

  // periodic scheduler
  this._scheduler = new Scheduler();

  // collection of connections
  this._conn = [];

  // master pattern matcher
  this._pattern = new Pattern();

  // the store - this is where the data lives
  this._store = new Store(this._conf);

  // ensure we have a database at index 0
  // the SELECT command will lazily create databases
  // on demand
  if(this._store.databases[0] === undefined) {
    this._store.getDatabase(0, {pattern: this._pattern});
  }

  // server statistics
  this._stats = new Stats(this);

  // server information
  this._info = new Info(this);

  // global pubsub state
  this._pubsub = new PubSub(this._stats);

  // slow log storage
  this._slowlog = new SlowLog(this._conf);

  function onSave(time, diff, version, file) {
    this._lastsave = Date.now();
    this.log.notice('db saved to disk: %s seconds (%s)', time, file)
  }
  Persistence.on('save', onSave.bind(this));

  process.on('debug', debug.bind(this));
  process.on('tick', expire.bind(this));
}
543478
function NetworkServer(server) {
  this.server = server;
  function connection(socket) {
    server.connection(socket, this);
  }
  this.on('connection', connection);
}
1345578
public void run() {
    LOG.info("The server runs and prepares for leader election");
    if (failoverWatcher.blockUntilActive()) {
      LOG.info("The server becomes active master and prepare to do business logic");
      doAsActiveServer();
    }
    failoverWatcher.close();
    LOG.info("The server exits after running business logic");
  }
213259
def serve(self):
        """"""
        while self.ready:
            try:
                self.tick()
            except (KeyboardInterrupt, SystemExit):
                raise
            except Exception:
                self.error_log(
                    'Error in HTTPServer.tick', level=logging.ERROR,
                    traceback=True,
                )

            if self.interrupt:
                while self.interrupt is True:
                    # Wait for self.stop() to complete. See _set_interrupt.
                    time.sleep(0.1)
                if self.interrupt:
                    raise self.interrupt
1252127
private function initServerGlobal()
    {

        $entryUrl = $this->config['entryUrl'];
        $entryFile = $this->config['entryScript'] ?: basename($entryUrl);
        $entryScript = $this->config['entryScript'] ?: parse_url($entryUrl, PHP_URL_PATH);
        $_SERVER = array_merge($_SERVER, [
            'SCRIPT_FILENAME' => $entryFile,
            'SCRIPT_NAME' => $entryScript,
            'SERVER_NAME' => parse_url($entryUrl, PHP_URL_HOST),
            'SERVER_PORT' => parse_url($entryUrl, PHP_URL_PORT) ?: '80',
            'HTTPS' => parse_url($entryUrl, PHP_URL_SCHEME) === 'https'
        ]);
    }
1334273
function Server(options) {
  var that = this;
  that.options = options || {};
  that.stack = [];
  bind.call(that);
}
290082
private static void registerServer(Server server, Database db) {

        if (!serverMap.containsKey(server)) {
            serverMap.put(server, new HashSet());
        }

        HashSet databases = (HashSet) serverMap.get(server);

        databases.add(db);
    }
1050773
protected function startServer(): void
    {
        $this->guardServerStarting();

        $this->process = new Process($this->prepareCommand());
        $this->process->setWorkingDirectory($this->laravelPublicPath());
        $this->process->start();
    }
205608
public function set_state() {
		if ( ! empty( $this->struct['state'] ) ) {
			$this->classes[] = 'notice-' . $this->struct['state'];
		} else {
			$this->classes[] = 'notice-warning';
		}
	}
310163
function() {
  EventEmitter.call(this);
  this.httpServer = new HttpServer();

  var self = this;
  this.wsServer = new WebSocketServer({server: this.httpServer});

  this.wsServer.on('connection', function(socket) {
    // emit socket to outside
    self.emit('connection', socket);
  });

  this.state = ST_STARTED;
}
314019
def define(self):
        """"""
        self.server_def = self.consul.define_server(
                self.name,
                self.server_tpl,
                self.server_tpl_rev,
                self.instance_type,
                self.ssh_key_name,
                tags=self.tags,
                availability_zone=self.availability_zone,
                security_groups=self.security_groups,
                **self.provider_extras
                )
        log.debug('Defined server %s' % self.server_def)
1104572
private function setServer()
    {
        if (isset($_SERVER)) {
            foreach ($_SERVER as $k => $v) {
                $this->log->debug("[ SERVER Params ]" . $k . ": " . $v, []);
                $this->server->$k = $v;
                $this->parameters["server"][$k] = $v;
            }
            unset($_SERVER);
        }
    }
1046065
protected B server(boolean isServer) {
        enforceConstraint("server", "connection", connection);
        enforceConstraint("server", "codec", decoder);
        enforceConstraint("server", "codec", encoder);

        this.isServer = isServer;
        return self();
    }
833478
synchronized void processFinished() {
        final InternalState required = this.requiredState;
        final InternalState state = this.internalState;
        // If the server was not stopped
        if(required == InternalState.STOPPED && state == InternalState.PROCESS_STOPPING) {
            finishTransition(InternalState.PROCESS_STOPPING, InternalState.PROCESS_STOPPED);
        } else {
            this.requiredState = InternalState.STOPPED;
            if ( !(internalSetState(getTransitionTask(InternalState.PROCESS_STOPPING), internalState, InternalState.PROCESS_STOPPING)
                    && internalSetState(getTransitionTask(InternalState.PROCESS_REMOVING), internalState, InternalState.PROCESS_REMOVING)
                    && internalSetState(getTransitionTask(InternalState.STOPPED), internalState, InternalState.STOPPED)) ){
                this.requiredState = InternalState.FAILED;
                internalSetState(null, internalState, InternalState.PROCESS_STOPPED);
            }
        }
    }
1318685
function() {

        if (asyncLogging) {
          if (workerId > 0) {
            Utility.asyncStepLogger(workerId + "\t Registering Server");
          } else {
            Utility.asyncStepLogger("Registering Server");
          }
        }

        var content = {
          name: serverName
        };

        pushSendData({
          type: asyncMessageType.SERVER_REGISTER,
          content: content
        });

        registerServerTimeoutId = setTimeout(function() {
          if (!isServerRegister) {
            registerServer();
          }
        }, connectionRetryInterval);
      }
654141
function(state) {
    if (state == self.LOADING || self.readyState !== state) {
      self.readyState = state;

      if (settings.async || self.readyState < self.OPENED || self.readyState === self.DONE) {
        self.dispatchEvent("readystatechange");
      }

      if (self.readyState === self.DONE && !errorFlag) {
        self.dispatchEvent("load");
        // @TODO figure out InspectorInstrumentation::didLoadXHR(cookie)
        self.dispatchEvent("loadend");
      }
    }
  }
1136051
private function initServer() {
        $this->http = new Object();
        $this->server = new Object();

        foreach ($_SERVER as $key => $val) {
            $key = str_replace('request_', '', strtolower($key));
            if (substr($key, 0, 5) === 'http_') {
                $this->http->{Util::_toCamel(substr($key, 5))} = $val;
            }
            elseif (substr($key, 0, 7) === 'server_') {
                $this->server->{Util::_toCamel(substr($key, 7))} = $val;
            }
            else {
                $this->{Util::_toCamel($key)} = $val;
            }
        }
    }