Jdk源码之Thread类详解
2023-09-14 09:13:18 时间
Jdk源码之Thread类详解
setDaemon()
方法的释义
/**
Marks this thread as either a linkplain #isDaemon daemon thread
or a user thread. The Java Virtual Machine exits when the only
threads running are all daemon threads.
标记这个线程作为一个linkplain isDaemon() daemon线程或者是一个用户线程。仅仅当运行的线程是所有的守护线程时,java虚拟机则会退出。
This method must be invoked before the thread is started.
这个方法必须在线程被启动时调用。
@param on
if {@code true}, marks this thread as a daemon thread
如果参数on为true,则标记这个线程是一个守护线程
@throws IllegalThreadStateException
if this thread is {@linkplain #isAlive alive}
@throws SecurityException
if {@link #checkAccess} determines that the current
thread cannot modify this thread
*/
setDaemon()
方法的代码
public final void setDaemon(boolean on) {
checkAccess();
if (isAlive()) {
throw new IllegalThreadStateException();
}
daemon = on;
}
相关文章
- Java JDK下载与安装
- Ubuntu 11.10 安装JDK
- maven 解决 Eclipse is running in a JRE, but a JDK is
- Eclipse/Myeclipse中查看和调试JDK源代码的方法
- java jdk 历史版本下载
- 新手学Linux(一)----安装JDK
- Spring AOP源码分析(二)JDK动态代理和CGLIB介绍
- linux(ubuntu21.10):安装jdk-17(java 17.0.3.1)
- Eclipse 如何查看jdk源码
- jdk and tomcat 环境变量配置
- 【项目实战】从0开始入门JDK源码 - ArrayList源码 之 overflow-conscious code
- JDK版本切换(以1.5和1.8为例)
- Jdk源码详解之ArrayBlockingQueue类
- Jdk源码详解之ThreadPoolExecutor 类
- 框架源码常客JDK动态代理模式
- ubuntu 安装 JDK
- jdk配置