随笔分类 -  线程

Java多线程
摘要:一、Future Future是一个接口,所有方法如下: 上源码: package java.util.concurrent; public interface Future<V> { boolean cancel(boolean mayInterruptIfRunning); boolean is 阅读全文
posted @ 2023-02-01 15:20 卫旗 阅读(108) 评论(0) 推荐(0)
摘要:一、概述 execute和submit都是线程池中执行任务的方法。 execute是Executor接口中的方法 public interface Executor { void execute(Runnable command); } submit是ExecuteService接口中的方法。 pu 阅读全文
posted @ 2023-02-01 15:18 卫旗 阅读(1473) 评论(0) 推荐(0)
摘要:一、线程池有哪些优点 减少资源开销,不用频繁的创建和销毁线程 提高响应时长,有任务时可直接执行。 提高线程的可管理性,所有线程资源都由线程池统一管理。 二、线程池的主要参数 线程池ThreadPoolExecutor的继承关系: 想知道有哪些参数,先看参数最多的构造函数: public Thread 阅读全文
posted @ 2023-01-31 10:53 卫旗 阅读(1163) 评论(0) 推荐(1)