java7并发编程学习笔记
来源:互联网 发布:商超网络信息平台 编辑:程序博客网 时间:2024/05/18 00:15
1.java线程状态
A thread state. A thread can be in one of the following states:
NEW
A thread that has not yet started is in this state.RUNNABLE
A thread executing in the Java virtual machine is in this state.BLOCKED
A thread that is blocked waiting for a monitor lock is in this state.WAITING
A thread that is waiting indefinitely for another thread to perform a particular action is in this state.TIMED_WAITING
A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state.TERMINATED
A thread that has exited is in this state.
A thread can be in only one state at a given point in time. These states are virtual machine states which do not reflect any operating system thread states.
2.Thread.interrupted()静态方法检查当前线程是否中断,并清除中断状态。 Thread实例的isInterrupted()方法只返回线程中断状态,推荐使用。
3.sleep()方法线程不会释放对象锁,wait()方法线程会放弃对象锁。
4.两种同步机制:synchronized关键字 和 Lock接口
0 0
- java7并发编程学习笔记
- JAVA7并发编程手册笔记
- Java7并发学习笔记(一)
- [笔记][Java7并发编程实战手册]6.并发集合
- [笔记][Java7并发编程实战手册]7. 定制并发类
- [笔记][Java7并发编程实战手册]系列目录
- Java7并发编程--5、并发集合
- [笔记][Java7并发编程实战手册]3.2 资源的并发访问控制Semaphore信号量
- [笔记][Java7并发编程实战手册]3.3 资源的多副本并发访问控制Semaphore
- [笔记][Java7并发编程实战手册]3.6 并发阶段任务的运行phaser
- [笔记][Java7并发编程实战手册]3.7 并发阶段任务中的阶段切换phaser
- [笔记][Java7并发编程实战手册]3.8 并发任务间的数据交换Exchanger
- java7 MethodHandle学习笔记
- java7 invokedynamic学习笔记
- java7 MethodHandle学习笔记
- java7 MethodHandle学习笔记
- Java7并发编程--1、线程管理
- Java7并发编程--3.1、信号量Semaphore机制
- C#MVC中自带验证
- PostgresSQL
- asp.net mvc新建运行Debug时,提示 此操作要求使用 IIS 集成管线模式
- 用debugserver + lldb代替gdb进行动态调试
- libc2.14安装
- java7并发编程学习笔记
- linux反汇编
- 系统图标和其它应用程序快捷方式异常:“图标文字后缀全部变成.lnk”解决方法
- 汉诺塔(三)
- Ubuntu图形界面下使用root权限登录
- Hive内部表、外部表区别
- 【设计模式】责任链3-横刀植入
- eclipse启动弹窗提示*.log
- java小程序查看器