scheduledthreadpoolexecutor.html

来自「j2se5-api-zh,java文档的中文版本」· HTML 代码 · 共 828 行 · 第 1/4 页

HTML
828
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.5.0_03) on Wed Nov 02 09:51:48 CST 2005 --><META http-equiv="Content-Type" content="text/html; charset=gb2312"><TITLE>ScheduledThreadPoolExecutor (Java 2 Platform SE 5.0)</TITLE><META NAME="keywords" CONTENT="java.util.concurrent.ScheduledThreadPoolExecutor class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){    parent.document.title="ScheduledThreadPoolExecutor (Java 2 Platform SE 5.0)";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="跳过导航链接"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>概述</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>类</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/ScheduledThreadPoolExecutor.html"><FONT CLASS="NavBarFont1"><B>使用</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>已过时</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Standard&nbsp;Ed. 5.0</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="ScheduledFuture.html" title="java.util.concurrent 中的接口"><B>上一个类</B></A>&nbsp;&nbsp;<A HREF="Semaphore.html" title="java.util.concurrent 中的类"><B>下一个类</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../../index.html@java_2Futil_2Fconcurrent_2FScheduledThreadPoolExecutor.html" target="_top"><B>框架</B></A>  &nbsp;&nbsp;<A HREF="ScheduledThreadPoolExecutor.html" target="_top"><B>无框架</B></A>  &nbsp;&nbsp;<SCRIPT type="text/javascript">  <!--  if(window==top) {    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>所有类</B></A>');  }  //--></SCRIPT><NOSCRIPT>  <A HREF="../../../allclasses-noframe.html"><B>所有类</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  摘要:&nbsp;<A HREF="#nested_classes_inherited_from_class_java.util.concurrent.ThreadPoolExecutor">嵌套</A>&nbsp;|&nbsp;字段&nbsp;|&nbsp;<A HREF="#constructor_summary">构造方法</A>&nbsp;|&nbsp;<A HREF="#method_summary">方法</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">详细信息:&nbsp;字段&nbsp;|&nbsp;<A HREF="#constructor_detail">构造方法</A>&nbsp;|&nbsp;<A HREF="#method_detail">方法</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.util.concurrent</FONT><BR>类 ScheduledThreadPoolExecutor</H2><PRE><A HREF="../../lang/Object.html" title="java.lang 中的类">java.lang.Object</A>  <IMG SRC="../../../resources/inherit.gif" ALT="继承者 "><A HREF="AbstractExecutorService.html" title="java.util.concurrent 中的类">java.util.concurrent.AbstractExecutorService</A>      <IMG SRC="../../../resources/inherit.gif" ALT="继承者 "><A HREF="ThreadPoolExecutor.html" title="java.util.concurrent 中的类">java.util.concurrent.ThreadPoolExecutor</A>          <IMG SRC="../../../resources/inherit.gif" ALT="继承者 "><B>java.util.concurrent.ScheduledThreadPoolExecutor</B></PRE><DL><DT><B>所有已实现的接口:</B> <DD><A HREF="Executor.html" title="java.util.concurrent 中的接口">Executor</A>, <A HREF="ExecutorService.html" title="java.util.concurrent 中的接口">ExecutorService</A>, <A HREF="ScheduledExecutorService.html" title="java.util.concurrent 中的接口">ScheduledExecutorService</A></DD></DL><HR><DL><DT><PRE>public class <B>ScheduledThreadPoolExecutor</B><DT>extends <A HREF="ThreadPoolExecutor.html" title="java.util.concurrent 中的类">ThreadPoolExecutor</A><DT>implements <A HREF="ScheduledExecutorService.html" title="java.util.concurrent 中的接口">ScheduledExecutorService</A></DL></PRE><P><A HREF="ThreadPoolExecutor.html" title="java.util.concurrent 中的类"><CODE>ThreadPoolExecutor</CODE></A>,它可另行安排在给定的延迟后运行命令,或者定期执行命令。需要多个辅助线程时,或者要求 <A HREF="ThreadPoolExecutor.html" title="java.util.concurrent 中的类"><CODE>ThreadPoolExecutor</CODE></A> 具有额外的灵活性或功能时,此类要优于 <A HREF="../Timer.html" title="java.util 中的类"><CODE>Timer</CODE></A>。<p> 一旦启用已延迟的任务就执行它,但是有关何时启用,启用后何时执行则没有任何实时保证。按照提交的先进先出 (FIFO) 顺序来启用那些被安排在同一执行时间的任务。<p>虽然此类继承自 <A HREF="ThreadPoolExecutor.html" title="java.util.concurrent 中的类"><CODE>ThreadPoolExecutor</CODE></A>,但是几个继承的调整方法对此类并无作用。特别是,因为它作为一个使用 <tt>corePoolSize</tt> 线程和一个无界队列的固定大小的池,所以调整 <tt>maximumPoolSize</tt> 没有什么效果。<P><P><DL><DT><B>从以下版本开始:</B></DT>  <DD>1.5</DD></DL><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><A NAME="nested_class_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>嵌套类摘要</B></FONT></TH></TR></TABLE>&nbsp;<A NAME="nested_classes_inherited_from_class_java.util.concurrent.ThreadPoolExecutor"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>从类 java.util.concurrent.<A HREF="ThreadPoolExecutor.html" title="java.util.concurrent 中的类">ThreadPoolExecutor</A> 继承的嵌套类/接口</B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="ThreadPoolExecutor.AbortPolicy.html" title="java.util.concurrent 中的类">ThreadPoolExecutor.AbortPolicy</A>, <A HREF="ThreadPoolExecutor.CallerRunsPolicy.html" title="java.util.concurrent 中的类">ThreadPoolExecutor.CallerRunsPolicy</A>, <A HREF="ThreadPoolExecutor.DiscardOldestPolicy.html" title="java.util.concurrent 中的类">ThreadPoolExecutor.DiscardOldestPolicy</A>, <A HREF="ThreadPoolExecutor.DiscardPolicy.html" title="java.util.concurrent 中的类">ThreadPoolExecutor.DiscardPolicy</A></CODE></TD></TR></TABLE>&nbsp;<!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>构造方法摘要</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="ScheduledThreadPoolExecutor.html#ScheduledThreadPoolExecutor(int)">ScheduledThreadPoolExecutor</A></B>(int&nbsp;corePoolSize)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;使用给定核心池大小创建一个新 ScheduledThreadPoolExecutor。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="ScheduledThreadPoolExecutor.html#ScheduledThreadPoolExecutor(int, java.util.concurrent.RejectedExecutionHandler)">ScheduledThreadPoolExecutor</A></B>(int&nbsp;corePoolSize,                            <A HREF="RejectedExecutionHandler.html" title="java.util.concurrent 中的接口">RejectedExecutionHandler</A>&nbsp;handler)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;使用给定初始参数创建一个新 ScheduledThreadPoolExecutor。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="ScheduledThreadPoolExecutor.html#ScheduledThreadPoolExecutor(int, java.util.concurrent.ThreadFactory)">ScheduledThreadPoolExecutor</A></B>(int&nbsp;corePoolSize,                            <A HREF="ThreadFactory.html" title="java.util.concurrent 中的接口">ThreadFactory</A>&nbsp;threadFactory)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;使用给定的初始参数创建一个新 ScheduledThreadPoolExecutor。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="ScheduledThreadPoolExecutor.html#ScheduledThreadPoolExecutor(int, java.util.concurrent.ThreadFactory09FBF0999A">ScheduledThreadPoolExecutor</A></B>(int&nbsp;corePoolSize,                            <A HREF="ThreadFactory.html" title="java.util.concurrent 中的接口">ThreadFactory</A>&nbsp;threadFactory,                            <A HREF="RejectedExecutionHandler.html" title="java.util.concurrent 中的接口">RejectedExecutionHandler</A>&nbsp;handler)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;使用给定初始参数创建一个新 ScheduledThreadPoolExecutor。</TD></TR></TABLE>&nbsp;<!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>方法摘要</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="ScheduledThreadPoolExecutor.html#execute(java.lang.Runnable)">execute</A></B>(<A HREF="../../lang/Runnable.html" title="java.lang 中的接口">Runnable</A>&nbsp;command)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;使用所要求的零延迟执行命令。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="ScheduledThreadPoolExecutor.html#getContinueExistingPeriodicTasksAfterShutdownPolicy()">getContinueExistingPeriodicTasksAfterShutdownPolicy</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;获得有关在此执行程序已 <tt>shutdown</tt> 的情况下、是否继续执行现有定期任务的策略。</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="ScheduledThreadPoolExecutor.html#getExecuteExistingDelayedTasksAfterShutdownPolicy()">getExecuteExistingDelayedTasksAfterShutdownPolicy</A></B>()</CODE>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?