随笔分类 - 并发
摘要:https://www.cnblogs.com/three-fighter/p/14396208.html
阅读全文
摘要:
阅读全文
摘要:正确的停止线程 使用interrupu来通知,而不是强制 interrupu仅仅是通知,线程本身具有决定权是否终止,原因:线程本身了解自己的运行状态,即:自己的任务是不是已经完成了,所以把决定权交给线程自己 public class RightWayStop implements Runnable
阅读全文
摘要:start()与run()的比较 public class StartAndRunMethod { public static void main(String[] args) { Runnable runnable = () ->{ System.out.println(Thread.curren
阅读全文
摘要:public class wrongways { public static void main(String[] args) { ExecutorService executorService = Executors.newCachedThreadPool(); for(int i = 0;i <
阅读全文
摘要:实现Runnable接口 public class RunnableStyle implements Runnable { public static void main(String[] args) { Thread thread = new Thread(new RunnableStyle())
阅读全文
摘要:https://blog.csdn.net/xyls12345/article/details/26256693
阅读全文