public static class ThreadPoolUtil.SingleThreadPoolExecutor extends Object
如果新提交,有正在运行的任务,取消掉; 如果队列满,则丢弃最旧的。
注意: 可能当前任务结束不掉,直到运行结束完成,再运行最后提交的任务
如果有循环,则循环结束条件因该使用 Thread.interrupted(); 判断是否被打断,返回 true 应该结束循环
SingleThreadPoolExecutor(String name)
Future
getFuture()
void
submit(Runnable runnable)
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public SingleThreadPoolExecutor(String name)
public void submit(Runnable runnable)
public Future getFuture()
Copyright © 2023. All rights reserved.