![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Java多线程编程
文章平均质量分 77
IT烂笔头
这个作者很懒,什么都没留下…
展开
-
Java多线程编程(2)之线程同步
volatile 先看个例子 class Test { // 定义一个全局变量 private boolean isRun = true; // 从主线程调用发起 public void process() { test(); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStack..原创 2021-05-03 19:29:17 · 303 阅读 · 6 评论 -
Java多线程应用(1)
目标:掌握多线程的使用及应用场景 怎么使用多线程 // 尽量不要如此使用 new Thread(new Runnable() { @Override public void run() { } }).start(); // 通过线程池方便管理 Executor executor = Executors.newCachedThreadPool(); executor.execute(runnable); 进程和线程的区别 其实没有可比.原创 2021-05-02 17:55:52 · 448 阅读 · 0 评论