java.util.Timer.sched()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中java.util.Timer.sched()方法的一些代码示例,展示了Timer.sched()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Timer.sched()方法的具体详情如下:
包路径:java.util.Timer
类名称:Timer
方法名:sched

Timer.sched介绍

[英]Schedule the specified timer task for execution at the specified time with the specified period, in milliseconds. If period is positive, the task is scheduled for repeated execution; if period is zero, the task is scheduled for one-time execution. Time is specified in Date.getTime() format. This method checks timer state, task state, and initial execution time, but not period.
[中]以毫秒为单位,在指定的时间和指定的时间段安排指定的计时器任务执行。如果周期为正,则计划重复执行任务;如果周期为零,则计划一次性执行任务。时间以日期指定。getTime()格式。此方法检查计时器状态、任务状态和初始执行时间,但不检查周期。

代码示例

代码示例来源:origin: org.apidesign.bck2brwsr/emul.mini

/**
 * Schedules the specified task for execution at the specified time.  If
 * the time is in the past, the task is scheduled for immediate execution.
 *
 * @param task task to be scheduled.
 * @param time time at which task is to be executed.
 * @throws IllegalArgumentException if <tt>time.getTime()</tt> is negative.
 * @throws IllegalStateException if task was already scheduled or
 *         cancelled, timer was cancelled, or timer thread terminated.
 * @throws NullPointerException if {@code task} or {@code time} is null
 */
public void schedule(TimerTask task, Date time) {
  sched(task, time.getTime(), 0);
}

代码示例来源:origin: jtulach/bck2brwsr

/**
 * Schedules the specified task for execution at the specified time.  If
 * the time is in the past, the task is scheduled for immediate execution.
 *
 * @param task task to be scheduled.
 * @param time time at which task is to be executed.
 * @throws IllegalArgumentException if <tt>time.getTime()</tt> is negative.
 * @throws IllegalStateException if task was already scheduled or
 *         cancelled, timer was cancelled, or timer thread terminated.
 * @throws NullPointerException if {@code task} or {@code time} is null
 */
public void schedule(TimerTask task, Date time) {
  sched(task, time.getTime(), 0);
}

代码示例来源:origin: dragome/dragome-sdk

/**
 * Schedules the specified task for execution at the specified time.  If
 * the time is in the past, the task is scheduled for immediate execution.
 *
 * @param task task to be scheduled.
 * @param time time at which task is to be executed.
 * @throws IllegalArgumentException if <tt>time.getTime()</tt> is negative.
 * @throws IllegalStateException if task was already scheduled or
 *         cancelled, timer was cancelled, or timer thread terminated.
 * @throws NullPointerException if {@code task} or {@code time} is null
 */
public void schedule(TimerTask task, Date time)
{
  sched(task, time.getTime(), 0);
}

代码示例来源:origin: dragome/dragome-sdk

/**
 * Schedules the specified task for execution after the specified delay.
 *
 * @param task  task to be scheduled.
 * @param delay delay in milliseconds before task is to be executed.
 * @throws IllegalArgumentException if <tt>delay</tt> is negative, or
 *         <tt>delay + System.currentTimeMillis()</tt> is negative.
 * @throws IllegalStateException if task was already scheduled or
 *         cancelled, timer was cancelled, or timer thread terminated.
 * @throws NullPointerException if {@code task} is null
 */
public void schedule(TimerTask task, long delay)
{
  if (delay < 0)
    throw new IllegalArgumentException("Negative delay.");
  sched(task, System.currentTimeMillis() + delay, 0);
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul.mini

if (period <= 0)
  throw new IllegalArgumentException("Non-positive period.");
sched(task, firstTime.getTime(), period);

代码示例来源:origin: org.apidesign.bck2brwsr/emul.mini

/**
 * Schedules the specified task for execution after the specified delay.
 *
 * @param task  task to be scheduled.
 * @param delay delay in milliseconds before task is to be executed.
 * @throws IllegalArgumentException if <tt>delay</tt> is negative, or
 *         <tt>delay + System.currentTimeMillis()</tt> is negative.
 * @throws IllegalStateException if task was already scheduled or
 *         cancelled, timer was cancelled, or timer thread terminated.
 * @throws NullPointerException if {@code task} is null
 */
public void schedule(TimerTask task, long delay) {
  if (delay < 0)
    throw new IllegalArgumentException("Negative delay.");
  sched(task, System.currentTimeMillis()+delay, 0);
}

代码示例来源:origin: jtulach/bck2brwsr

if (period <= 0)
  throw new IllegalArgumentException("Non-positive period.");
sched(task, firstTime.getTime(), period);

代码示例来源:origin: org.apidesign.bck2brwsr/emul.mini

if (period <= 0)
  throw new IllegalArgumentException("Non-positive period.");
sched(task, firstTime.getTime(), -period);

代码示例来源:origin: jtulach/bck2brwsr

/**
 * Schedules the specified task for execution after the specified delay.
 *
 * @param task  task to be scheduled.
 * @param delay delay in milliseconds before task is to be executed.
 * @throws IllegalArgumentException if <tt>delay</tt> is negative, or
 *         <tt>delay + System.currentTimeMillis()</tt> is negative.
 * @throws IllegalStateException if task was already scheduled or
 *         cancelled, timer was cancelled, or timer thread terminated.
 * @throws NullPointerException if {@code task} is null
 */
public void schedule(TimerTask task, long delay) {
  if (delay < 0)
    throw new IllegalArgumentException("Negative delay.");
  sched(task, System.currentTimeMillis()+delay, 0);
}

代码示例来源:origin: jtulach/bck2brwsr

if (period <= 0)
  throw new IllegalArgumentException("Non-positive period.");
sched(task, firstTime.getTime(), -period);

代码示例来源:origin: dragome/dragome-sdk

sched(task, firstTime.getTime(), -period);

代码示例来源:origin: dragome/dragome-sdk

sched(task, firstTime.getTime(), period);

代码示例来源:origin: dragome/dragome-sdk

if (period <= 0)
  throw new IllegalArgumentException("Non-positive period.");
sched(task, System.currentTimeMillis() + delay, period);

代码示例来源:origin: dragome/dragome-sdk

if (period <= 0)
  throw new IllegalArgumentException("Non-positive period.");
sched(task, System.currentTimeMillis() + delay, -period);

代码示例来源:origin: org.apidesign.bck2brwsr/emul.mini

if (period <= 0)
  throw new IllegalArgumentException("Non-positive period.");
sched(task, System.currentTimeMillis()+delay, -period);

代码示例来源:origin: org.apidesign.bck2brwsr/emul.mini

if (period <= 0)
  throw new IllegalArgumentException("Non-positive period.");
sched(task, System.currentTimeMillis()+delay, period);

代码示例来源:origin: jtulach/bck2brwsr

if (period <= 0)
  throw new IllegalArgumentException("Non-positive period.");
sched(task, System.currentTimeMillis()+delay, period);

代码示例来源:origin: jtulach/bck2brwsr

if (period <= 0)
  throw new IllegalArgumentException("Non-positive period.");
sched(task, System.currentTimeMillis()+delay, -period);

相关文章