b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

scheduledthreadpoolexecutor?java线程池?fileoutputstream 追加?API之(2)

电脑杂谈  发布时间:2016-09-25 17:02:00  来源:网络整理

ScheduledFuture<?> scheduleAtFixedRate(Runnablecommand, longinitialDelay, longperiod, TimeUnitunit)
创建并执行一个在给定初始延迟后首次启用的定期操作,后续操作具有给定的周期;也就是将在 initialDelay 后开始执行,然后在 initialDelay+period 后执行,接着在 initialDelay + 2 * period 后执行,依此类推。

ScheduledFuture<?> scheduleWithFixedDelay(Runnablecommand, longinitialDelay, longdelay, TimeUnitunit)
创建并执行一个在给定初始延迟后首次启用的定期操作,随后,在每一次执行终止和下一次执行开始之间都存在给定的延迟。

void setContinueExistingPeriodicTasksAfterShutdownPolicy(booleanvalue)
设置有关在此执行程序已 shutdown 的情况下是否继续执行现有定期任务的策略。

void setExecuteExistingDelayedTasksAfterShutdownPolicy(booleanvalue)
设置有关在此执行程序已 shutdown 的情况下是否继续执行现有延迟任务的策略。

void shutdown()
在以前已提交任务的执行中发起一个有序的关闭,但是不接受新任务。

List<Runnable> shutdownNow()
尝试停止所有正在执行的任务、暂停等待任务的处理,并返回等待执行的任务列表。

<T> Future<T>

submit(Callable<T>task)
提交一个返回值的任务用于执行,返回一个表示任务的未决结果的 Future。

Future<?> submit(Runnabletask)
提交一个 Runnable 任务用于执行,并返回一个表示该任务的 Future。

<T> Future<T>

submit(Runnabletask, Tresult)
提交一个 Runnable 任务用于执行,并返回一个表示该任务的 Future。

从类 java.util.concurrent.ThreadPoolExecutor 继承的方法

afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, terminated

从类 java.util.concurrent.AbstractExecutorService 继承的方法

invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor

从类 java.lang.Object 继承的方法

clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

从接口 java.util.concurrent.ExecutorService 继承的方法

awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated

构造方法详细信息

scheduledthreadpoolexecutor

public scheduledthreadpoolexecutor(intcorePoolSize) 使用给定核心池大小创建一个新 scheduledthreadpoolexecutor

参数:
corePoolSize - 池中所保存的线程数(包括空闲线程)
抛出:
IllegalArgumentException - 如果 corePoolSize < 0

scheduledthreadpoolexecutor

public scheduledthreadpoolexecutor(intcorePoolSize, ThreadFactorythreadFactory)
使用给定的初始参数创建一个新 scheduledthreadpoolexecutor

参数:
corePoolSize - 池中所保存的线程数(包括空闲线程)
threadFactory - 执行程序创建新线程时使用的工厂
抛出:
IllegalArgumentException - 如果 corePoolSize < 0
NullPointerException - 如果 threadFactory 为 null

scheduledthreadpoolexecutor

public scheduledthreadpoolexecutor(intcorePoolSize, RejectedExecutionHandlerhandler)
使用给定初始参数创建一个新 scheduledthreadpoolexecutor

参数:
corePoolSize - 池中所保存的线程数(包括空闲线程)
handler - 由于超出线程范围和队列容量而使执行被阻塞时所使用的处理程序
抛出:
IllegalArgumentException - 如果 corePoolSize < 0
NullPointerException - 如果处理程序为 null

scheduledthreadpoolexecutor

public scheduledthreadpoolexecutor(intcorePoolSize, ThreadFactorythreadFactory, RejectedExecutionHandlerhandler)
使用给定初始参数创建一个新 scheduledthreadpoolexecutor


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-17399-2.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...