📄 taskengine.html
字号:
<BR> Schedules the specified task for repeated <i>fixed-rate execution</i>, beginning at the specified time.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/jivesoftware/util/TaskEngine.html#scheduleAtFixedRate(java.util.TimerTask, long, long)">scheduleAtFixedRate</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/TimerTask.html" title="class or interface in java.util">TimerTask</A> task, long delay, long period)</CODE><BR> Schedules the specified task for repeated <i>fixed-rate execution</i>, beginning after the specified delay.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/jivesoftware/util/TaskEngine.html#shutdown()">shutdown</A></B>()</CODE><BR> Shuts down the task engine service.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Future.html" title="class or interface in java.util.concurrent">Future</A><?></CODE></FONT></TD><TD><CODE><B><A HREF="../../../org/jivesoftware/util/TaskEngine.html#submit(java.lang.Runnable)">submit</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runnable.html" title="class or interface in java.lang">Runnable</A> task)</CODE><BR> Submits a Runnable task for execution and returns a Future representing that task.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD></TR></TABLE> <P><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="getInstance()"><!-- --></A><H3>getInstance</H3><PRE>public static <A HREF="../../../org/jivesoftware/util/TaskEngine.html" title="class in org.jivesoftware.util">TaskEngine</A> <B>getInstance</B>()</PRE><DL><DD>Returns a task engine instance (singleton).<P><DD><DL><DT><B>Returns:</B><DD>a task engine.</DL></DD></DL><HR><A NAME="submit(java.lang.Runnable)"><!-- --></A><H3>submit</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Future.html" title="class or interface in java.util.concurrent">Future</A><?> <B>submit</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runnable.html" title="class or interface in java.lang">Runnable</A> task)</PRE><DL><DD>Submits a Runnable task for execution and returns a Future representing that task.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>task</CODE> - the task to submit.<DT><B>Returns:</B><DD>a Future representing pending completion of the task, and whose <tt>get()</tt> method will return <tt>null</tt> upon completion.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/RejectedExecutionException.html" title="class or interface in java.util.concurrent">RejectedExecutionException</A></CODE> - if task cannot be scheduled for execution.<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/NullPointerException.html" title="class or interface in java.lang">NullPointerException</A></CODE> - if task null.</DL></DD></DL><HR><A NAME="schedule(java.util.TimerTask, long)"><!-- --></A><H3>schedule</H3><PRE>public void <B>schedule</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/TimerTask.html" title="class or interface in java.util">TimerTask</A> task, long delay)</PRE><DL><DD>Schedules the specified task for execution after the specified delay.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>task</CODE> - task to be scheduled.<DD><CODE>delay</CODE> - delay in milliseconds before task is to be executed.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <tt>delay</tt> is negative, or <tt>delay + System.currentTimeMillis()</tt> is negative.<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if task was already scheduled or cancelled, or timer was cancelled.</DL></DD></DL><HR><A NAME="schedule(java.util.TimerTask, java.util.Date)"><!-- --></A><H3>schedule</H3><PRE>public void <B>schedule</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/TimerTask.html" title="class or interface in java.util">TimerTask</A> task, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Date.html" title="class or interface in java.util">Date</A> time)</PRE><DL><DD>Schedules the specified task for execution at the specified time. If the time is in the past, the task is scheduled for immediate execution.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>task</CODE> - task to be scheduled.<DD><CODE>time</CODE> - time at which task is to be executed.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <tt>time.getTime()</tt> is negative.<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if task was already scheduled or cancelled, timer was cancelled, or timer thread terminated.</DL></DD></DL><HR><A NAME="schedule(java.util.TimerTask, long, long)"><!-- --></A><H3>schedule</H3><PRE>public void <B>schedule</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/TimerTask.html" title="class or interface in java.util">TimerTask</A> task, long delay, long period)</PRE><DL><DD>Schedules the specified task for repeated <i>fixed-delay execution</i>, beginning after the specified delay. Subsequent executions take place at approximately regular intervals separated by the specified period. <p>In fixed-delay execution, each execution is scheduled relative to the actual execution time of the previous execution. If an execution is delayed for any reason (such as garbage collection or other background activity), subsequent executions will be delayed as well. In the long run, the frequency of execution will generally be slightly lower than the reciprocal of the specified period (assuming the system clock underlying <tt>Object.wait(long)</tt> is accurate). <p>Fixed-delay execution is appropriate for recurring activities that require "smoothness." In other words, it is appropriate for activities where it is more important to keep the frequency accurate in the short run than in the long run. This includes most animation tasks, such as blinking a cursor at regular intervals. It also includes tasks wherein regular activity is performed in response to human input, such as automatically repeating a character as long as a key is held down.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>task</CODE> - task to be scheduled.<DD><CODE>delay</CODE> - delay in milliseconds before task is to be executed.<DD><CODE>period</CODE> - time in milliseconds between successive task executions.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <tt>delay</tt> is negative, or <tt>delay + System.currentTimeMillis()</tt> is negative.<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if task was already scheduled or cancelled, timer was cancelled, or timer thread terminated.</DL></DD></DL><HR><A NAME="schedule(java.util.TimerTask, java.util.Date, long)"><!-- --></A><H3>schedule</H3><PRE>public void <B>schedule</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/TimerTask.html" title="class or interface in java.util">TimerTask</A> task, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Date.html" title="class or interface in java.util">Date</A> firstTime, long period)</PRE><DL><DD>Schedules the specified task for repeated <i>fixed-delay execution</i>, beginning at the specified time. Subsequent executions take place at approximately regular intervals, separated by the specified period. <p>In fixed-delay execution, each execution is scheduled relative to the actual execution time of the previous execution. If an execution is delayed for any reason (such as garbage collection or other background activity), subsequent executions will be delayed as well. In the long run, the frequency of execution will generally be slightly lower than the reciprocal of the specified period (assuming the system clock underlying <tt>Object.wait(long)</tt> is accurate). <p>Fixed-delay execution is appropriate for recurring activities
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -