Schedules our next regularly scheduled reboot.

@return true if a reboot was scheduled, false if regularly scheduled reboots are disabled.
513010
public boolean scheduleRegularReboot ()
    {
        // maybe schedule an automatic reboot based on our configuration
        int freq = getDayFrequency();
        int hour = getRebootHour();
        if (freq <= 0) {
            return false;
        }

        Calendars.Builder cal = Calendars.now();
        int curHour = cal.get(Calendar.HOUR_OF_DAY);
        cal = cal.zeroTime().addHours(hour).addDays((curHour < hour) ? (freq - 1) : freq);

        // maybe avoid weekends
        if (getSkipWeekends()) {
            switch (cal.get(Calendar.DAY_OF_WEEK)) {
            case Calendar.SATURDAY:
                cal.addDays(2);
                break;

            case Calendar.SUNDAY:
                cal.addDays(1);
                break;
            }
        }

        scheduleReboot(cal.toTime(), true, AUTOMATIC_INITIATOR); // schedule exactly
        return true;
    }
1280575
def should_reschedule(self, iteration, bracket_iteration):
        """"""
        bracket = self.get_bracket(iteration=iteration)
        if bracket_iteration < bracket:
            # The bracket is still processing
            return False

        # We can only reschedule if we can create a new bracket
        return self.get_bracket(iteration=iteration + 1) >= 0
384734
public boolean stop() {
        if (!this.isTailing.get()) {
            LogWatchTailingManager.LOGGER.debug("Tailer not running, therefore not terminating.");
            return false;
        }
        /*
         * terminate tailer; we stop the scheduler and the task will therefore
         * never be started again
         */
        this.tailer.stop();
        LogWatchTailingManager.LOGGER.info("Terminated tailing #{} for {}.",
                this.numberOfTimesThatTailerWasStarted.get(), this.watch);
        return true;
    }
963510
public boolean runScheduler() {
    IScheduler scheduler = null;

    String statemgrClass = Context.stateManagerClass(config);
    IStateManager statemgr;

    try {
      // create an instance of state manager
      statemgr = ReflectionUtils.newInstance(statemgrClass);
    } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {
      LOG.log(Level.SEVERE, "Failed to instantiate instances using config: " + config, e);
      return false;
    }

    SchedulerServer server = null;
    boolean isSuccessful = false;

    // Put it in a try block so that we can always clean resources
    try {
      // initialize the state manager
      statemgr.initialize(config);

      // TODO(mfu): timeout should read from config
      SchedulerStateManagerAdaptor adaptor = new SchedulerStateManagerAdaptor(statemgr, 5000);

      // get a packed plan and schedule it
      PackingPlans.PackingPlan serializedPackingPlan = adaptor.getPackingPlan(topology.getName());
      if (serializedPackingPlan == null) {
        LOG.log(Level.SEVERE, "Failed to fetch PackingPlan for topology:{0} from the state manager",
            topology.getName());
        return false;
      }
      LOG.log(Level.INFO, "Packing plan fetched from state: {0}", serializedPackingPlan);
      PackingPlan packedPlan = new PackingPlanProtoDeserializer().fromProto(serializedPackingPlan);

      // build the runtime config
      LauncherUtils launcherUtils = LauncherUtils.getInstance();
      Config runtime = Config.newBuilder()
          .putAll(launcherUtils.createPrimaryRuntime(topology))
          .putAll(launcherUtils.createAdaptorRuntime(adaptor))
          .put(Key.SCHEDULER_SHUTDOWN, getShutdown())
          .put(Key.SCHEDULER_PROPERTIES, properties)
          .build();

      Config ytruntime = launcherUtils.createConfigWithPackingDetails(runtime, packedPlan);

      // invoke scheduler
      scheduler = launcherUtils.getSchedulerInstance(config, ytruntime);
      if (scheduler == null) {
        return false;
      }

      isSuccessful = scheduler.onSchedule(packedPlan);
      if (!isSuccessful) {
        LOG.severe("Failed to schedule topology");
        return false;
      }

      // Failures in server initialization throw exceptions
      // get the scheduler server endpoint for receiving requests
      server = getServer(ytruntime, scheduler, schedulerServerPort);
      // start the server to manage runtime requests
      server.start();

      // write the scheduler location to state manager
      // Make sure it happens after IScheduler.onScheduler
      isSuccessful = SchedulerUtils.setSchedulerLocation(
          runtime, String.format("%s:%d", server.getHost(), server.getPort()), scheduler);

      if (isSuccessful) {
        // wait until kill request or some interrupt occurs if the scheduler starts successfully
        LOG.info("Waiting for termination... ");
        Runtime.schedulerShutdown(ytruntime).await();
      }
    } catch (IOException e) {
      LOG.log(Level.SEVERE, "Failed to start server", e);
      return false;
    } finally {
      // Clean the resources
      if (server != null) {
        server.stop();
      }

      // 4. Close the resources
      SysUtils.closeIgnoringExceptions(scheduler);
      SysUtils.closeIgnoringExceptions(statemgr);
    }

    return isSuccessful;
  }
1206119
protected boolean doesStartingTimeAllowServiceAccess() {
        if (this.startingDateTime != null) {
            val st = DateTimeUtils.zonedDateTimeOf(this.startingDateTime);
            if (st != null) {
                val now = ZonedDateTime.now(ZoneOffset.UTC);
                if (now.isBefore(st)) {
                    LOGGER.warn("Service access not allowed because it starts at [{}]. Zoned now is [{}]", this.startingDateTime, now);
                    return false;
                }
            } else {
                val stLocal = DateTimeUtils.localDateTimeOf(this.startingDateTime);
                if (stLocal != null) {
                    val now = LocalDateTime.now(ZoneOffset.UTC);
                    if (now.isBefore(stLocal)) {
                        LOGGER.warn("Service access not allowed because it starts at [{}]. Local now is [{}]", this.startingDateTime, now);
                        return false;
                    }
                }
            }
        }
        return true;
    }
957950
public boolean isEnabled() {
        if (daysOfWeek != null && daysOfWeek.length > 0) {
            return true;
        }
        if (timesOfDay != null && timesOfDay.size() > 0) {
            return true;
        }
        return false;
    }
188601
def reboot(name, call=None):
    '''
    
    '''
    conn = get_conn()
    node = get_node(conn, name)

    conn.modify_server_status(server_id=node['id'], action='REBOOT')

    return True
122226
def is_enabled(name):
    '''
    
    '''

    current_schedule = __salt__['schedule.list'](show_all=False, return_yaml=False)
    if name in current_schedule:
        return current_schedule[name]
    else:
        return {}
489636
public boolean reboot() {
        if (!sendCommand("reboot")) {
            return false;
        }

        // wait 1 second
        try {
            Thread.sleep(1000);
        } catch (InterruptedException ex) {
        }

        disconnect();

        // check that remote host is not accessible anymore
        // open a socket without any parameters. It hasn't been binded or connected
        try (Socket socket = new Socket()) {
            // bind to a local ephemeral port
            socket.bind(null);
            socket.connect(new InetSocketAddress(remoteHost, RLoginClient.DEFAULT_PORT), 1);
        } catch (SocketTimeoutException e) {
            logger.info("Rebooted host " + remoteHost + " successfully");
            return true;
        } catch (IOException e) {
            logger.error("Something went wrong while rebooting host:" + remoteHost);
            return false;
        }
        // Expected to get an exception as the remote host should not be reachable anymore
        logger.error(
              "Host " + remoteHost + " did not reboot as expected! Please check that no other rlogin client is connected!");
        return false;
    }
185022
public final boolean stop() {

        if (booting || running) {
            stopping = true;
            booting = false;
            onStopping();
            return true;
        } else {
            return false;
        }

    }
631542
boolean runResumeReadWrite() {
        boolean ret = false;
        if(anyAreSet(state, FLAG_SHOULD_RESUME_WRITES)) {
            responseChannel.runResume();
            ret = true;
        }
        if(anyAreSet(state, FLAG_SHOULD_RESUME_READS)) {
            requestChannel.runResume();
            ret = true;
        }
        return ret;
    }
1031429
function () {
      var i;
      for (i = 0; i < arguments.length; i++) {
         if (!this.is_lambda_scheduled(arguments[i])) {
            return false;
         }
      }
      return true;
   }
126179
public function planNextRun()
    {
        if ($this->is_repeating_task && !empty($this->cron_expression)) {
            $this->status = DeferredQueue::STATUS_SCHEDULED;
            $cron = CronExpression::factory($this->cron_expression);
            $this->next_start = date('Y-m-d H:i:s', $cron->getNextRunDate()->getTimestamp());
            return true;
        } else {
            return false;
        }
    }
540902
public function everyOddWeek()
    {
        $this->setScheduleMonth(self::ANY);
        $this->setScheduleWeek('odd');
        $this->setScheduleDayOfMonth(self::ANY);
        $this->setScheduleDayOfWeek(self::ANY);
        $this->setScheduleHour(0);
        $this->setScheduleMinute(0);

        return $this;
    }
1105832
private Boolean switchCheckAndAbortLocked() {
    if (!hasExpansionOccurred()) {
      clearOutReferences();
      return true;
    }
    hashArray = hash.getEntries();
    clearCount = hash.getClearOrCloseCount();
    boolean _cacheClosed = hashArray == null;
    if (_cacheClosed) {
      clearOutReferences();
      throw new CacheClosedException(cache);
    }
    return false;
  }
284839
private boolean scheduleRolloutGroup(final JpaRollout rollout, final JpaRolloutGroup group) {
        final long targetsInGroup = rolloutTargetGroupRepository.countByRolloutGroup(group);
        final long countOfActions = actionRepository.countByRolloutAndRolloutGroup(rollout, group);

        long actionsLeft = targetsInGroup - countOfActions;
        if (actionsLeft > 0) {
            actionsLeft -= createActionsForRolloutGroup(rollout, group);
        }

        if (actionsLeft <= 0) {
            group.setStatus(RolloutGroupStatus.SCHEDULED);
            rolloutGroupRepository.save(group);
            return true;
        }
        return false;
    }
1116912
private boolean isScheduled(JobInProgress job) {
    return ((job.pendingMaps() < job.desiredMaps()) 
        || (job.pendingReduces() < job.desiredReduces()));
  }