runnable.html
来自「j2se5-api-zh,java文档的中文版本」· HTML 代码 · 共 700 行 · 第 1/3 页
HTML
700 行
返回此执行程序使用的任务队列。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../util/concurrent/BlockingQueue.html" title="java.util.concurrent 中的接口">BlockingQueue</A><<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A>></CODE></FONT></TD><TD><CODE><B>ScheduledThreadPoolExecutor.</B><B><A HREF="../../util/concurrent/ScheduledThreadPoolExecutor.html#getQueue()">getQueue</A></B>()</CODE><BR> 返回此执行程序使用的任务队列。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../util/List.html" title="java.util 中的接口">List</A><<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A>></CODE></FONT></TD><TD><CODE><B>ThreadPoolExecutor.</B><B><A HREF="../../util/concurrent/ThreadPoolExecutor.html#shutdownNow()">shutdownNow</A></B>()</CODE><BR> 尝试停止所有的活动执行任务、暂停等待任务的处理,并返回等待执行的任务列表。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../util/List.html" title="java.util 中的接口">List</A><<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A>></CODE></FONT></TD><TD><CODE><B>ScheduledThreadPoolExecutor.</B><B><A HREF="../../util/concurrent/ScheduledThreadPoolExecutor.html#shutdownNow()">shutdownNow</A></B>()</CODE><BR> 尝试停止所有正在执行的任务、暂停等待任务的处理,并返回等待执行的任务列表。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../util/List.html" title="java.util 中的接口">List</A><<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A>></CODE></FONT></TD><TD><CODE><B>ExecutorService.</B><B><A HREF="../../util/concurrent/ExecutorService.html#shutdownNow()">shutdownNow</A></B>()</CODE><BR> 试图停止所有正在执行的活动任务,暂停处理正在等待的任务,并返回等待执行的任务列表。</TD></TR></TABLE> <P><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"><TH ALIGN="left" COLSPAN="2">参数类型为 <A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> 的 <A HREF="../../util/concurrent/package-summary.html">java.util.concurrent</A> 中的方法</FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B>ThreadPoolExecutor.</B><B><A HREF="../../util/concurrent/ThreadPoolExecutor.html#afterExecute(java.lang.Runnable, java.lang.Throwable)">afterExecute</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> r, <A HREF="../Throwable.html" title="java.lang 中的类">Throwable</A> t)</CODE><BR> 基于完成执行给定 Runnable 所调用的方法。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected void</CODE></FONT></TD><TD><CODE><B>ThreadPoolExecutor.</B><B><A HREF="../../util/concurrent/ThreadPoolExecutor.html#beforeExecute(java.lang.Thread, java.lang.Runnable)">beforeExecute</A></B>(<A HREF="../Thread.html" title="java.lang 中的类">Thread</A> t, <A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> r)</CODE><BR> 在执行给定线程中的给定 Runnable 之前调用的方法。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../util/concurrent/Callable.html" title="java.util.concurrent 中的接口">Callable</A><<A HREF="../Object.html" title="java.lang 中的类">Object</A>></CODE></FONT></TD><TD><CODE><B>Executors.</B><B><A HREF="../../util/concurrent/Executors.html#callable(java.lang.Runnable)">callable</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> task)</CODE><BR> 返回 <A HREF="../../util/concurrent/Callable.html" title="java.util.concurrent 中的接口"><CODE>Callable</CODE></A> 对象,调用它时可运行给定的任务并返回 <tt>null</tt>。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""><TR ALIGN="right" VALIGN=""><TD NOWRAP><FONT SIZE="-1"><CODE><T> <A HREF="../../util/concurrent/Callable.html" title="java.util.concurrent 中的接口">Callable</A><T></CODE></FONT></TD></TR></TABLE></CODE></FONT></TD><TD><CODE><B>Executors.</B><B><A HREF="../../util/concurrent/Executors.html#callable(java.lang.Runnable, T)">callable</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> task, T result)</CODE><BR> 返回 <A HREF="../../util/concurrent/Callable.html" title="java.util.concurrent 中的接口"><CODE>Callable</CODE></A> 对象,调用它时可运行给定的任务并返回给定的结果。</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>ThreadPoolExecutor.</B><B><A HREF="../../util/concurrent/ThreadPoolExecutor.html#execute(java.lang.Runnable)">execute</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> command)</CODE><BR> 在将来某个时间执行给定任务。</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>ScheduledThreadPoolExecutor.</B><B><A HREF="../../util/concurrent/ScheduledThreadPoolExecutor.html#execute(java.lang.Runnable)">execute</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> command)</CODE><BR> 使用所要求的零延迟执行命令。</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>Executor.</B><B><A HREF="../../util/concurrent/Executor.html#execute(java.lang.Runnable)">execute</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> command)</CODE><BR> 在未来某个时间执行给定的命令。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../Thread.html" title="java.lang 中的类">Thread</A></CODE></FONT></TD><TD><CODE><B>ThreadFactory.</B><B><A HREF="../../util/concurrent/ThreadFactory.html#newThread(java.lang.Runnable)">newThread</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> r)</CODE><BR> 构造一个新 <tt>Thread</tt>。</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>ThreadPoolExecutor.CallerRunsPolicy.</B><B><A HREF="../../util/concurrent/ThreadPoolExecutor.CallerRunsPolicy.html#rejectedExecution(java.lang.Runnable, java.util.concurrent.ThreadPoolExecutor)">rejectedExecution</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> r, <A HREF="../../util/concurrent/ThreadPoolExecutor.html" title="java.util.concurrent 中的类">ThreadPoolExecutor</A> e)</CODE><BR> 调用方线程中的执行任务 r;如果执行程序已关闭,则会丢弃该任务。</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>ThreadPoolExecutor.AbortPolicy.</B><B><A HREF="../../util/concurrent/ThreadPoolExecutor.AbortPolicy.html#rejectedExecution(java.lang.Runnable, java.util.concurrent.ThreadPoolExecutor)">rejectedExecution</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> r, <A HREF="../../util/concurrent/ThreadPoolExecutor.html" title="java.util.concurrent 中的类">ThreadPoolExecutor</A> e)</CODE><BR> 总是抛出 RejectedExecutionException。</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>ThreadPoolExecutor.DiscardPolicy.</B><B><A HREF="../../util/concurrent/ThreadPoolExecutor.DiscardPolicy.html#rejectedExecution(java.lang.Runnable, java.util.concurrent.ThreadPoolExecutor)">rejectedExecution</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> r, <A HREF="../../util/concurrent/ThreadPoolExecutor.html" title="java.util.concurrent 中的类">ThreadPoolExecutor</A> e)</CODE><BR> 不执行任何操作,在这种情况下将放弃任务 r。</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>ThreadPoolExecutor.DiscardOldestPolicy.</B><B><A HREF="../../util/concurrent/ThreadPoolExecutor.DiscardOldestPolicy.html#rejectedExecution(java.lang.Runnable, java.util.concurrent.ThreadPoolExecutor)">rejectedExecution</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> r, <A HREF="../../util/concurrent/ThreadPoolExecutor.html" title="java.util.concurrent 中的类">ThreadPoolExecutor</A> e)</CODE><BR> 获取并忽略下一个任务,否则如果该任务立即可用,执行程序将执行该任务,然后再试图重新执行任务 r;如果执行程序已关闭,则会丢弃任务 r。</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>RejectedExecutionHandler.</B><B><A HREF="../../util/concurrent/RejectedExecutionHandler.html#rejectedExecution(java.lang.Runnable, java.util.concurrent.ThreadPoolExecutor)">rejectedExecution</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> r, <A HREF="../../util/concurrent/ThreadPoolExecutor.html" title="java.util.concurrent 中的类">ThreadPoolExecutor</A> executor)</CODE><BR> 当 <tt>execute</tt> 不能接受某个任务时,可以由 <A HREF="../../util/concurrent/ThreadPoolExecutor.html" title="java.util.concurrent 中的类"><CODE>ThreadPoolExecutor</CODE></A> 调用的方法。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B>ThreadPoolExecutor.</B><B><A HREF="../../util/concurrent/ThreadPoolExecutor.html#remove(java.lang.Runnable)">remove</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> task)</CODE><BR> 从执行程序的内部队列中移除此任务(如果出现),这样如果尚未开始,则其不再运行。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B>ScheduledThreadPoolExecutor.</B><B><A HREF="../../util/concurrent/ScheduledThreadPoolExecutor.html#remove(java.lang.Runnable)">remove</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> task)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../util/concurrent/ScheduledFuture.html" title="java.util.concurrent 中的接口">ScheduledFuture</A><?></CODE></FONT></TD><TD><CODE><B>ScheduledThreadPoolExecutor.</B><B><A HREF="../../util/concurrent/ScheduledThreadPoolExecutor.html#schedule(java.lang.Runnable, long, java.util.concurrent.TimeUnit)">schedule</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> command, long delay, <A HREF="../../util/concurrent/TimeUnit.html" title="java.util.concurrent 中的枚举">TimeUnit</A> unit)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../util/concurrent/ScheduledFuture.html" title="java.util.concurrent 中的接口">ScheduledFuture</A><?></CODE></FONT></TD><TD><CODE><B>ScheduledExecutorService.</B><B><A HREF="../../util/concurrent/ScheduledExecutorService.html#schedule(java.lang.Runnable, long, java.util.concurrent.TimeUnit)">schedule</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> command, long delay, <A HREF="../../util/concurrent/TimeUnit.html" title="java.util.concurrent 中的枚举">TimeUnit</A> unit)</CODE><BR> 创建并执行在给定延迟后启用的一次性操作。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../util/concurrent/ScheduledFuture.html" title="java.util.concurrent 中的接口">ScheduledFuture</A><?></CODE></FONT></TD><TD><CODE><B>ScheduledThreadPoolExecutor.</B><B><A HREF="../../util/concurrent/ScheduledThreadPoolExecutor.html#scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)">scheduleAtFixedRate</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> command, long initialDelay, long period, <A HREF="../../util/concurrent/TimeUnit.html" title="java.util.concurrent 中的枚举">TimeUnit</A> unit)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../util/concurrent/ScheduledFuture.html" title="java.util.concurrent 中的接口">ScheduledFuture</A><?></CODE></FONT></TD><TD><CODE><B>ScheduledExecutorService.</B><B><A HREF="../../util/concurrent/ScheduledExecutorService.html#scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)">scheduleAtFixedRate</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> command, long initialDelay, long period, <A HREF="../../util/concurrent/TimeUnit.html" title="java.util.concurrent 中的枚举">TimeUnit</A> unit)</CODE><BR> 创建并执行一个在给定初始延迟后首次启用的定期操作,后续操作具有给定的周期;也就是将在 <tt>initialDelay</tt> 后开始执行,然后在 <tt>initialDelay+period</tt> 后执行,接着在 <tt>initialDelay + 2 * period</tt> 后执行,依此类推。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../util/concurrent/ScheduledFuture.html" title="java.util.concurrent 中的接口">ScheduledFuture</A><?></CODE></FONT></TD><TD><CODE><B>ScheduledThreadPoolExecutor.</B><B><A HREF="../../util/concurrent/ScheduledThreadPoolExecutor.html#scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)">scheduleWithFixedDelay</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> command, long initialDelay, long delay, <A HREF="../../util/concurrent/TimeUnit.html" title="java.util.concurrent 中的枚举">TimeUnit</A> unit)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../util/concurrent/ScheduledFuture.html" title="java.util.concurrent 中的接口">ScheduledFuture</A><?></CODE></FONT></TD><TD><CODE><B>ScheduledExecutorService.</B><B><A HREF="../../util/concurrent/ScheduledExecutorService.html#scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit)">scheduleWithFixedDelay</A></B>(<A HREF="../Runnable.html" title="java.lang 中的接口">Runnable</A> command,
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?