文章分类 -  线程及线程池

摘要:public class MyThread1 { static Object o1 = new Object(); static Object o2 = new Object(); // 模式死锁 public static void main(String[] args) { new Thread 阅读全文
posted @ 2021-11-18 16:57 zlloiiyt 阅读(126) 评论(0) 推荐(0) 编辑
摘要:无论是Runnable接口的实现类还是Callable接口的实现类,都可以被ThreadPoolExecutor或ScheduledThreadPoolExecutor执行, ThreadPoolExecutor或ScheduledThreadPoolExecutor都实现了 ExcutorServ 阅读全文
posted @ 2021-11-18 16:51 zlloiiyt 阅读(34) 评论(0) 推荐(0) 编辑
摘要:第一种继承Thread类: public class MyThread extends Thread{ @Override public void run() { System.out.println(Thread.currentThread().getName()+"线程"); } } publi 阅读全文
posted @ 2021-11-18 16:27 zlloiiyt 阅读(155) 评论(0) 推荐(0) 编辑
摘要:public interface Executor { void execute(Runnable command); } public interface ExecutorService extends Executor { ... void shutdown(); <T> Future<T> s 阅读全文
posted @ 2021-11-18 11:48 zlloiiyt 阅读(34) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示