Schedule a reboot.

@param exact if false we round up to the next highest warning time.
966483
protected void scheduleReboot (long rebootTime, boolean exact, String initiator)
    {
        // if there's already a reboot scheduled, cancel it
        cancelReboot();

        long now = System.currentTimeMillis();
        rebootTime = Math.max(rebootTime, now); // don't let reboots happen in the past
        long delay = rebootTime - now;
        int[] warnings = getWarnings();
        int level = -1; // assume we're not yet warning
        for (int ii = warnings.length - 1; ii >= 0; ii--) {
            long warnTime = warnings[ii] * (60L * 1000L);
            if (delay <= warnTime) {
                level = ii;
                if (!exact) {
                    rebootTime = now + warnTime;
                }
                break;
            }
        }

        // note our new reboot time and its initiator
        _nextReboot = rebootTime;
        _initiator = initiator;

        doWarning(level, (int)((rebootTime - now) / (60L * 1000L)));
    }
273844
async def reboot():
    """"""
    async with aiohttp.ClientSession() as session:
        ghlocalapi = DeviceSettings(LOOP, session, IPADDRESS)
        result = await ghlocalapi.reboot()

        print("Reboot info:", result)
310132
@Nonnull
  public static SimpleScheduleBuilder repeatMinutelyForTotalCount (final int nCount, final int nMinutes)
  {
    ValueEnforcer.isGT0 (nCount, "Count");
    return simpleSchedule ().withIntervalInMinutes (nMinutes).withRepeatCount (nCount - 1);
  }
1204414
protected void schedule() {
    try (LockResource r = new LockResource(mLock)) {
      Preconditions.checkState(!mScheduled, "Called schedule twice without waiting for any ticks");
      mScheduled = true;
      mTickCondition.signal();
      HeartbeatScheduler.removeTimer(this);
    }
  }
1147743
void reExecutePeriodic(RunnableScheduledFuture<?> task) {
        if (canRunInCurrentRunState(true)) {
            super.getQueue().add(task);
            if (!canRunInCurrentRunState(true) && remove(task))
                task.cancel(false);
            else
                ensurePrestart();
        }
    }
919584
private void scheduleFlushTask()
   {
      // cancel task
      if (flushTask != null)
      {
         flushTask.cancel();
      }
      // clear canceled tasks
      FLUSH_TIMER.purge();
      // new flush task, cause canceled can't be re-used
      flushTask = new TimerTask()
      {
         @Override
         public void run()
         {
            // check if volatile index should be flushed
            checkFlush();
         }
      };
      FLUSH_TIMER.schedule(flushTask, 0, 1000);
      lastFlushTime = System.currentTimeMillis();
      lastFileSystemFlushTime = System.currentTimeMillis();
   }
241605
def _scheduleRestart(self,
                         when: Union[datetime, str],
                         failTimeout) -> None:
        
        logger.info("{}'s restarter processing restart"
                    .format(self))
        if isinstance(when, str):
            when = dateutil.parser.parse(when)
        now = datetime.utcnow().replace(tzinfo=dateutil.tz.tzutc())

        logger.info(
            "Restart of node '{}' has been scheduled on {}".format(
                self.nodeName, when))

        ev_data = RestartLogData(when)
        self._actionLog.append_scheduled(ev_data)

        callAgent = partial(self._callRestartAgent, ev_data,
                            failTimeout)
        delay = 0
        if now < when:
            delay = (when - now).total_seconds()
        self.scheduledAction = ev_data
        self._schedule(callAgent, delay)
1034432
protected void scheduleTtl(K key, MapEntryValue value) {
    if (value.ttl() > 0) {
      value.timer = getScheduler().schedule(Duration.ofMillis(value.ttl()), () -> {
        entries().remove(key, value);
        publish(new AtomicMapEvent<>(AtomicMapEvent.Type.REMOVE, key, null, toVersioned(value)));
      });
    }
  }
993677
private void scheduleRetryFuture() {
        Log.v(Log.TAG_SYNC, "%s: Failed to xfer; will retry in %d sec", this, RETRY_DELAY_SECONDS);
        synchronized (executor) {
            if (!executor.isShutdown()) {
                this.retryFuture = executor.schedule(new Runnable() {
                    public void run() {
                        retryIfReady();
                    }
                }, RETRY_DELAY_SECONDS, TimeUnit.SECONDS);
            }
        }
    }
179249
public static br force_reboot(nitro_service client, br resource) throws Exception
	{
		return ((br[]) resource.perform_operation(client, "force_reboot"))[0];
	}
1067281
private void scheduleKeepAlive() {
    if (keepAlive != null)
      keepAlive.cancel();
    keepAlive = context.schedule(interval, () -> {
      keepAlive = null;
      if (state.getState().active()) {
        keepAlive();
      }
    });
  }
1321844
def reboot(self, timeout=None, wait_polling_interval=None):
        
        if timeout is None:
            timeout = self._timeout
        if wait_polling_interval is None:
            wait_polling_interval = self._wait_polling_interval

        self._logger.info("Rebooting device")
        self.wait_for_device_ready(timeout,
                                   after_first=lambda:self.command_output(["reboot"]))
266149
public static ns force_reboot(nitro_service client, ns resource) throws Exception
	{
		return ((ns[]) resource.perform_operation(client, "force_reboot"))[0];
	}
1215696
private void reschedule() {
        // set up a daily roll
        Calendar cal = Calendar.getInstance();
        long today = cal.getTimeInMillis();

        // adjust to somewhere after midnight of the next day
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.add(Calendar.DATE, 1);
        long tomorrow = cal.getTimeInMillis();

        if (executorService != null) {
            future = executorService.schedule(this, tomorrow - today, TimeUnit.MILLISECONDS);
        }
    }
90092
def _schedule(self):
        ''''''
        if self._running:
            _logger.debug('')
            self._call_later_handle = self._event_loop.call_later(
                self._timeout, self._check)
1184813
public boolean withEveryRetryWaitFor(int time, TimeUnit units) {
        for (int i = 1; i <= retries; i++) {
            if (openSocket()) {
                return true;
            }
            sleepFor(time, units);
        }
        return false;
    }
632830
async def reboot(self):
        """"""
        endpoint = '/setup/reboot'
        url = API.format(ip=self._ipaddress, endpoint=endpoint)
        data = {'params': 'now'}
        returnvalue = False
        try:
            async with async_timeout.timeout(5, loop=self._loop):
                result = await self._session.post(url, json=data,
                                                  headers=HEADERS)
                if result.status == 200:
                    returnvalue = True
        except (asyncio.TimeoutError,
                aiohttp.ClientError, socket.gaierror) as error:
            _LOGGER.error('Error connecting to GHLocalApi, %s', error)
        return returnvalue