1 Star 0 Fork 0

firewaycoding/think_in_java

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
DaemonThreadFactory.java 773 Bytes
一键复制 编辑 原始数据 按行查看 历史
firewaycoding 提交于 2019-03-14 07:29 +08:00 . 本次应用修改:调整目录架构
package concurrency;
import java.util.concurrent.ThreadFactory;
/**
* 通过编写定制的ThreadFactory可以定制由Executor创建的线程的属性(后台、优先级、名称)
*
* 2018年 09月 23日 星期日
* @author fireway
*/
public class DaemonThreadFactory implements ThreadFactory {
private static final boolean DEBUG = true;
@Override
public Thread newThread(Runnable r) {
if (DEBUG) {
System.out.println("DaemonThreadFactory.newThread() r[" + System.identityHashCode(r) + "]");
}
Thread t = new Thread();
if (DEBUG) {
System.out.println("DaemonThreadFactory.newThread() t[" + System.identityHashCode(t) + "]");
}
t.setDaemon(true);
return t;
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/firewaycoding/think_in_java.git
git@gitee.com:firewaycoding/think_in_java.git
firewaycoding
think_in_java
think_in_java
master

搜索帮助