Checking in with the central server informs it of the location and
 configuration of this Node. If it can't check-in, there's no point in
 starting.
8558
def check_in(critical=false)
      @central["/node/#{@id}"].put(
        :busy             => @overloaded,
        :tag              => @tag,
        :max_workers      => CloudCrowd.config[:max_workers],
        :enabled_actions  => @enabled_actions.join(',')
      )
    rescue RestClient::Exception, Errno::ECONNREFUSED
      CloudCrowd.log "Failed to connect to the central server (#{@central.to_s})."
      raise SystemExit if critical
    end
1321322
function checkState() {
                try {
                    var state = getDoc(io).readyState;
                    log('state = ' + state);
                    if (state && state.toLowerCase() == 'uninitialized')
                        setTimeout(checkState,50);
                }
                catch(e) {
                    log('Server abort: ' , e, ' (', e.name, ')');
                    cb(SERVER_ABORT);
                    if (timeoutHandle)
                        clearTimeout(timeoutHandle);
                    timeoutHandle = undefined;
                }
            }
1190767
function check() {
        if (done) {
          return;
        }
        checks--;
        if (checks <= 0) {
          return;
        }
        if (checks === 0) {
          done = true;
          finish(new Error('Machine unresponsive to STOP'));
          return;
        }
        var checkOptions = {
          method: 'GET',
          path: self.account + '/machines/' + serverId
        };

        self._request(checkOptions, function (err, body) {
          if (err) { return callback && callback(err) }
          if (body && body.state === 'stopped') {
            done = true;
            finish();
            return;
          }
        });

        setTimeout(check, 5000);
      }
799435
def in_check(self, position, location=None):
        
        location = location or self.location
        for piece in position:

            if piece is not None and piece.color != self.color:
                if not isinstance(piece, King):
                    for move in piece.possible_moves(position):

                        if move.end_loc == location:
                            return True
                else:
                    if self.loc_adjacent_to_opponent_king(piece.location, position):
                        return True

        return False
143038
def check(self, url_data):
        """"""
        location = get_location(url_data.host)
        if location:
            url_data.add_info(_("URL is located in %(location)s.") %
            {"location": _(location)})
233450
public synchronized void onDataReceived() {
    stopwatch.reset().start();
    // We do not cancel the ping future here. This avoids constantly scheduling and cancellation in
    // a busy transport. Instead, we update the status here and reschedule later. So we actually
    // keep one sendPing task always in flight when there're active rpcs.
    if (state == State.PING_SCHEDULED) {
      state = State.PING_DELAYED;
    } else if (state == State.PING_SENT || state == State.IDLE_AND_PING_SENT) {
      // Ping acked or effectively ping acked. Cancel shutdown, and then if not idle,
      // schedule a new keep-alive ping.
      if (shutdownFuture != null) {
        shutdownFuture.cancel(false);
      }
      if (state == State.IDLE_AND_PING_SENT) {
        // not to schedule new pings until onTransportActive
        state = State.IDLE;
        return;
      }
      // schedule a new ping
      state = State.PING_SCHEDULED;
      checkState(pingFuture == null, "There should be no outstanding pingFuture");
      pingFuture = scheduler.schedule(sendPing, keepAliveTimeInNanos, TimeUnit.NANOSECONDS);
    }
  }
519260
@Override
    public void serverStopping() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Server is stopping");
        }
        WebContainer wc = (WebContainer) WebContainer.getWebContainer();
        WebContainer.setServerStopping(true);
        if (wc!=null) wc.waitForApplicationInitialization();
    }
387171
private void serverInventoryInitialized()
  {
    long start = System.currentTimeMillis();
    long serverSyncWaitTimeout = config.getServerTimeout() + 2 * ChangeRequestHttpSyncer.HTTP_TIMEOUT_EXTRA_MS;

    List<DruidServerHolder> uninitializedServers = new ArrayList<>();
    for (DruidServerHolder server : servers.values()) {
      if (!server.isSyncedSuccessfullyAtleastOnce()) {
        uninitializedServers.add(server);
      }
    }

    while (!uninitializedServers.isEmpty() && ((System.currentTimeMillis() - start) < serverSyncWaitTimeout)) {
      try {
        Thread.sleep(5000);
      }
      catch (InterruptedException ex) {
        throw new RE(ex, "Interrupted while waiting for queryable server initial successful sync.");
      }

      log.info("Checking whether all servers have been synced at least once yet....");
      Iterator<DruidServerHolder> iter = uninitializedServers.iterator();
      while (iter.hasNext()) {
        if (iter.next().isSyncedSuccessfullyAtleastOnce()) {
          iter.remove();
        }
      }
    }

    if (uninitializedServers.isEmpty()) {
      log.info("All servers have been synced successfully at least once.");
    } else {
      for (DruidServerHolder server : uninitializedServers) {
        log.warn(
            "Server[%s] might not yet be synced successfully. We will continue to retry that in the background.",
            server.druidServer.getName()
        );
      }
    }

    log.info("Calling SegmentCallback.segmentViewInitialized() for all callbacks.");

    runSegmentCallbacks(
        new Function<SegmentCallback, CallbackAction>()
        {
          @Override
          public CallbackAction apply(SegmentCallback input)
          {
            return input.segmentViewInitialized();
          }
        }
    );
  }
922412
private void checkReady() {
    if (allReady()) {
      log.debug(String.format("%s - All components ready in network, starting components", NetworkManager.this));
      // Set the network's status key to the current context version. This
      // can be used by listeners to determine when a configuration change is complete.
      data.put(currentContext.status(), currentContext.version(), new Handler<AsyncResult<String>>() {
        @Override
        public void handle(AsyncResult<String> result) {
          if (result.failed()) {
            log.error(result.cause());
          }
        }
      });
    }
  }
212314
function nodeDomainInitialized(reset) {
        initState()
            .done(function () {
                var inProgress = updateJsonHandler.get(updateProgressKey);
                if (inProgress && reset) {
                    setUpdateStateInJSON(updateProgressKey, !reset)
                        .always(checkUpdateStatus);
                 } else if (!inProgress) {
                    checkUpdateStatus();
                }
            });
    }
227907
def local_check (self):
        
        if not self.host:
            self.set_result(_("Host is empty"), valid=False)
            return
        super(TelnetUrl, self).local_check()
577731
def ensure_on():
    
    if get_status() == 'not-running':
        if config.dbserver.multi_user:
            sys.exit('Please start the DbServer: '
                     'see the documentation for details')
        # otherwise start the DbServer automatically; NB: I tried to use
        # multiprocessing.Process(target=run_server).start() and apparently
        # it works, but then run-demos.sh hangs after the end of the first
        # calculation, but only if the DbServer is started by oq engine (!?)
        subprocess.Popen([sys.executable, '-m', 'openquake.server.dbserver',
                          '-l', 'INFO'])

        # wait for the dbserver to start
        waiting_seconds = 30
        while get_status() == 'not-running':
            if waiting_seconds == 0:
                sys.exit('The DbServer cannot be started after 30 seconds. '
                         'Please check the configuration')
            time.sleep(1)
            waiting_seconds -= 1
1342802
public void checkForDeadOrSleepingNodes(){
		int completeCount = 0;
		
		if (zwaveNodes.isEmpty())
			return;
		
		// There are still nodes waiting to get a ping.
		// So skip the dead node checking.
		for (SerialMessage serialMessage : sendQueue) {
			if (serialMessage.getPriority() == SerialMessage.SerialMessagePriority.Low)
				return;
		}
		
		logger.trace("Checking for Dead or Sleeping Nodes.");
		for (Map.Entry<Integer, ZWaveNode> entry : zwaveNodes.entrySet()){
			if (entry.getValue().getNodeStage() == ZWaveNode.NodeStage.NODEBUILDINFO_EMPTYNODE)
				continue;
			
			logger.debug(String.format("Node %d has been in Stage %s since %s", entry.getKey(), entry.getValue().getNodeStage().getLabel(), entry.getValue().getQueryStageTimeStamp().toString()));
			
			if(entry.getValue().getNodeStage() == ZWaveNode.NodeStage.NODEBUILDINFO_DONE || !entry.getValue().isListening()) {
				completeCount++;
				continue;
			}
			
			logger.trace("Checking if {} miliseconds have passed in current stage.", QUERY_STAGE_TIMEOUT);
			
			if(Calendar.getInstance().getTimeInMillis() < (entry.getValue().getQueryStageTimeStamp().getTime() + QUERY_STAGE_TIMEOUT))
				continue;
			
			logger.warn(String.format("Node %d may be dead, setting stage to DEAD.", entry.getKey()));
			entry.getValue().setNodeStage(ZWaveNode.NodeStage.NODEBUILDINFO_DEAD);

			completeCount++;
		}
		
		if(this.zwaveNodes.size() == completeCount){
			ZWaveEvent zEvent = new ZWaveEvent(ZWaveEventType.NETWORK_EVENT, 1, 0, "INIT_DONE");
			this.notifyEventListeners(zEvent);
		}
	}
1334625
def CheckLocation():
  """"""
  for url in (config.CONFIG["Client.server_urls"] +
              config.CONFIG["Client.control_urls"]):
    if "staging" in url or "localhost" in url:
      # This is ok.
      return
  logging.error("Poolclient should only be run against test or staging.")
  exit()
409734
public ReturnCode status(boolean starting) {
        // Use initialized bootstrap configuration to find the server lock file.
        ServerLock serverLock = ServerLock.createTestLock(bootProps);
        ReturnCode rc = ReturnCode.OK;

        // The lock file may have been (erroneously) deleted: this can happen on linux
        boolean lockExists = serverLock.lockFileExists();

        if (lockExists) {
            // If the lock exists, check quickly to see if the process is holding it.
            if (serverLock.testServerRunning()) {
                rc = ReturnCode.OK;
            } else {
                // nope: lock not held, we're not running
                rc = ReturnCode.REDUNDANT_ACTION_STATUS;
            }
        } else {
            // no lock file: we assume the server is not running.
            rc = ReturnCode.REDUNDANT_ACTION_STATUS;
        }

        if (rc == ReturnCode.OK) {
            String pid = getPID();
            if (pid == null) {
                if (starting) {
                    System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverIsAlreadyRunning"), serverName));
                } else {
                    System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverIsRunning"), serverName));
                }
            } else {
                if (starting) {
                    System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverIsAlreadyRunningWithPID"), serverName, pid));
                } else {
                    System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverIsRunningWithPID"), serverName, pid));
                }
            }
        } else if (rc == ReturnCode.REDUNDANT_ACTION_STATUS) {
            if (!starting) {
                System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverNotRunning"), serverName));
            }
        } else if (rc == ReturnCode.SERVER_NOT_EXIST_STATUS) {
            System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverNotExist"), serverName));
        } else {
            if (!starting) {
                System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverStatusException"), serverName));
            } else {
                if (rc == ReturnCode.SERVER_UNKNOWN_STATUS) {
                    String pid = getPID();
                    String pidFile = launchArgs.getOption(INTERNAL_PID_FILE);
                    if (pid == null || pidFile == null) {
                        System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverStartException"), serverName));
                    } else {
                        System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverStartUnreachable"), serverName, pidFile, pid));
                    }
                } else {
                    System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverStartException"), serverName));
                }
            }
        }

        return rc;
    }
1357912
def _check_once(self):
        
        address = self._server_description.address
        if self._publish:
            self._listeners.publish_server_heartbeat_started(address)
        with self._pool.get_socket({}) as sock_info:
            response, round_trip_time = self._check_with_socket(sock_info)
            self._avg_round_trip_time.add_sample(round_trip_time)
            sd = ServerDescription(
                address=address,
                ismaster=response,
                round_trip_time=self._avg_round_trip_time.get())
            if self._publish:
                self._listeners.publish_server_heartbeat_succeeded(
                    address, round_trip_time, response)

            return sd
809158
def _request_check(self, address):
        """"""
        server = self._servers.get(address)

        # "server" is None if another thread removed it from the topology.
        if server:
            server.request_check()