Schedule command to be run not earlier than time.
@param command
@param time Temporal that supports INSTANT_SECONDS and NANO_OF_SECOND.
@return
344214
public ScheduledFuture<?> schedule(Runnable command, TemporalAccessor time)
    {
        ensureWaiterRunning();
        log(logLevel, "schedule(%s, %s)", command, time);
        RunnableScheduledFutureImpl future = new RunnableScheduledFutureImpl(command, Instant.from(time), null, false);
        delayQueue.add(future);
        return future;
    }
275755
public void scheduleRecurring(Runnable runnable, Date firstTime, long period)
   {
	timer.scheduleAtFixedRate(toTimerTask(runnable), firstTime, period);
	
   }
1369159
@Override
  public Serializable schedule(String sessionId, String timerName, long miliseconds) throws IllegalArgumentException {
    String id = sessionId + "/" + timerName;
    logger.debug("Scheduling timer with id {}", id);

    if (this.ftScheduler.getTimerTaskData(id) != null) {
      throw new IllegalArgumentException("Timer already running: " + id);
    }

    DiameterTimerTaskData data = new DiameterTimerTaskData(id, miliseconds, sessionId, timerName);
    TimerTask tt = this.taskFactory.newTimerTask(data);
    ftScheduler.schedule(tt);
    return id;
  }
22570
private static String commandRun(Command command) {
        // Wait bind
        if (I_COMMAND == null) {
            synchronized (I_LOCK) {
                if (I_COMMAND == null) {
                    try {
                        I_LOCK.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }

        // Cancel Destroy Service
        cancelDestroyService();

        // Get result
        // In this we should try 5 count get the result
        int count = 5;
        Exception error = null;
        while (count > 0) {
            if (command.isCancel) {
                if (command.mListener != null)
                    command.mListener.onCancel();
                break;
            }
            try {
                command.mResult = I_COMMAND.command(command.mId, command.mTimeout, command.mParameters);
                if (command.mListener != null)
                    command.mListener.onCompleted(command.mResult);
                break;
            } catch (Exception e) {
                error = e;
                count--;
                try {
                    Thread.sleep(3000);
                } catch (InterruptedException e1) {
                    e1.printStackTrace();
                }
            }
        }

        // Check is Error
        if (count <= 0 && command.mListener != null) {
            command.mListener.onError(error);
        }

        // Check is end and call destroy service
        if (I_COMMAND != null) {
            try {
                if (I_COMMAND.getTaskCount() <= 0)
                    destroyService();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        // Return
        return command.mResult;
    }
1112051
public static void scheduleAtFixedRate(ScheduledExecutorService exec, Duration rate, Runnable runnable)
  {
    scheduleAtFixedRate(exec, rate, rate, runnable);
  }
357977
public static Timer schedule(
            TimeoutHandler timeoutHandler, Instant scheduledFor) {
        return scheduler.schedule(timeoutHandler, scheduledFor);
    }
29416
public void setTimeVal(long t) {
        int seconds = (int) (t / 1000);
        int millis = (int) (t - 1000 * t);
        this.timeVal = new TimeVal(seconds, millis * 1000, 0);
    }
603354
@javax.annotation.Nonnull
  public static TemporalUnit cvt(@javax.annotation.Nonnull final TimeUnit units) {
    switch (units) {
      case DAYS:
        return ChronoUnit.DAYS;
      case HOURS:
        return ChronoUnit.HOURS;
      case MINUTES:
        return ChronoUnit.MINUTES;
      case SECONDS:
        return ChronoUnit.SECONDS;
      case NANOSECONDS:
        return ChronoUnit.NANOS;
      case MICROSECONDS:
        return ChronoUnit.MICROS;
      case MILLISECONDS:
        return ChronoUnit.MILLIS;
      default:
        throw new IllegalArgumentException(units.toString());
    }
  }
699843
public static ScheduledFuture scheduleWithFixedDelay(Runnable runnable, long delayInMilli) {
        /* 我们默认设定一个runnable生命周期与一个msgId一一对应 */
        Runnable proxy = wrapRunnable(runnable, null);
        return newSingleThreadScheduler().scheduleWithFixedDelay(proxy, 0, delayInMilli, TimeUnit.MILLISECONDS);
    }
1254406
public static ScheduledFuture<?> runWithScheduleWithFixedDelayOnStartTime(
            ZonedDateTime startDateTime, long delayMillis, Runnable runnable) {
        return runWithScheduleWithFixedDelay(
                calInitialDelayMillis(startDateTime), delayMillis,
                "runWithScheduleWithFixedDelayOnStartTime", runnable);
    }
303720
private void scheduleBatchProcess(boolean immediate) {
        synchronized (mutex) {
            if (inbox.size() == 0)
                return;

            // Schedule the processing. To improve latency, if we haven't processed anything
            // in at least our delay time, rush these object(s) through a minimum delay:
            long suggestedDelay = 0;
            if (!immediate && inbox.size() < capacity) {
                // Check with the last processed time:
                if (System.currentTimeMillis() - lastProcessedTime < delay)
                    suggestedDelay = delay;
                else {
                    // Note: iOS schedules with 0 delay but the iOS implementation
                    // works on the runloop which still allows the current thread
                    // to continue queuing objects to the batcher until going out of
                    // the runloop. Java cannot do the same so giving a small delay to
                    // allow objects to be added to the batch if available:
                    suggestedDelay = Math.min(SMALL_DELAY_AFTER_LONG_PAUSE, delay);
                }
            }
            scheduleWithDelay(suggestedDelay);
        }
    }
133895
protected void scheduleRunAsync(Runnable runnable, Time delay) {
		scheduleRunAsync(runnable, delay.getSize(), delay.getUnit());
	}
689994
public <T extends KubernetesCommand> T command(T command) {
		action.setCommand(command);
		return command;
	}
85144
protected static String runCommand(String... command) {
		try {
			final Process p = Runtime.getRuntime().exec(command);
			if (p == null) {
				return null;
			}
			final StringBuilder bStr = new StringBuilder();
			try (InputStream standardOutput = p.getInputStream()) {
				final byte[] buffer = new byte[BUFFER_SIZE];
				int len;
				while ((len = standardOutput.read(buffer)) > 0) {
					bStr.append(new String(buffer, 0, len));
				}
				p.waitFor();
				return bStr.toString();
			}
		} catch (Exception e) {
			return null;
		}
	}
87276
public void sendCommand(MenuCommand command) {
        lastTx.set(clock.millis());
        try {
            connector.sendMenuCommand(command);
        } catch (IOException e) {
            logger.log(ERROR, "Error while writing out command", e);
            connector.close();
        }
    }
609507
def time(ctx: Context, command: str):
    """"""
    with timer.Timing(verbose=True):
        proc = run(command, shell=True)
    ctx.exit(proc.returncode)
908686
public ScheduledFuture<?> executePeriodically(Runnable command, long delay)
   {
      return executor.scheduleWithFixedDelay(command, 0, delay, TimeUnit.MILLISECONDS);
   }