会员
周边
众包
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
ITYW
博客园
首页
新随笔
联系
订阅
管理
[置顶]
JUC之线程池-三大方法-七大参数-四种拒绝策略
摘要: 线程池:重点 三大方法 七大参数 四种拒绝策略 使用池化技术的理由: 我们的程序伴随着创建销毁线程十分浪费资源, 所以使用线程池,先创建线程,随用随取,用完归还 简单来说就是节约了资源。 使用线程池的好处:节省资源(最大并发线程数可控);提高了响应速度;方便管理三大方法: 1.newFixedThr
阅读全文
posted @ 2020-10-25 17:23 ITYW
阅读(283)
评论(0)
推荐(0)
2020年11月18日
JUC之读写锁
摘要: * 读写锁: * 读读可以共存 * 读写不能共存 * 写写不能共存 * * 独占锁(写锁) * 共享锁(读锁) */public class ReadWriteLockTest { public static void main(String[] args) { MyCache myCache =
阅读全文
posted @ 2020-11-18 00:18 ITYW
阅读(129)
评论(0)
推荐(0)
2020年10月26日
线程通信---wait notify
摘要: /** * 线程通信 * * @Author: ITYW * @Create 2020 - 07 - 29 - 9:43 */public class Thread_wait_notify_notifyAll { public static void main(String[] args) { Nu
阅读全文
posted @ 2020-10-26 19:54 ITYW
阅读(103)
评论(0)
推荐(0)
线程安全方式03---Lock锁
摘要: /** * 线程安全 Lock方式 * * @Author: ITYW * @Create 2020 - 10 - 26 - 19:16 */public class RunnableSecurity_Lock { public static void main(String[] args) { R
阅读全文
posted @ 2020-10-26 19:48 ITYW
阅读(168)
评论(0)
推荐(0)
线程安全方式02Runnable---同步方法
摘要: /** * Runnable方式线程安全 同步方法 * * @Author: ITYW * @Create 2020 - 10 - 26 - 18:59 */public class RunnableSecurity02 { public static void main(String[] args
阅读全文
posted @ 2020-10-26 19:42 ITYW
阅读(117)
评论(0)
推荐(0)
线程安全方式2Runnable---同步代码块
摘要: /** * Runnable方式线程安全 同步代码块 * * @Author: ITYW * @Create 2020 - 10 - 26 - 18:47 */public class RunnableSecurity { public static void main(String[] args)
阅读全文
posted @ 2020-10-26 19:41 ITYW
阅读(75)
评论(0)
推荐(0)
线程安全方式1Thread类---同步代码块
摘要: /** * 基于Thread类的线程安全问题1 同步代码块方式 * * @Author: ITYW * @Create 2020 - 10 - 26 - 18:35 */public class ThreadSecurity02 { public static void main(String[]
阅读全文
posted @ 2020-10-26 19:38 ITYW
阅读(96)
评论(0)
推荐(0)
线程安全方式1Thread类---同步方法
摘要: 1.继承Thread类的方式 同步方法(以卖票为例) /** * 基于Thread类的线程安全问题1 同步方法 * * @Author: ITYW * @Create 2020 - 10 - 26 - 18:16 */public class ThreadSecurity { public stat
阅读全文
posted @ 2020-10-26 19:36 ITYW
阅读(141)
评论(0)
推荐(0)
2020年10月25日
线程中的Thread类中的方法
摘要: /** * 线程中常用的方法 * 1.start():启动线程,运行run()方法 * 2.run():是Thread类重写的方法,将线程需要执行的操作写在此方法中、 * 3.currentThread():返回当前线程 * 4.setName():设置线程名 * 5.getName():获取线程名
阅读全文
posted @ 2020-10-25 23:19 ITYW
阅读(220)
评论(0)
推荐(0)
多线程之创建线程的方式
摘要: 继承Thread类1.新建一个线程类继承Thread类2.重写run()3.在main方法中实例化线程对象4.调用start()public class Thread01{ public static void main(String []args){ MyThread t = new MyThre
阅读全文
posted @ 2020-10-25 17:21 ITYW
阅读(65)
评论(0)
推荐(0)
下一页
公告