/**
* 优先级
*/
public class PriorityDemo {
public static class HightPriority extends Thread{
static int count = 0; @Override
public void run() {
while (true){
synchronized (PriorityDemo.class){
count++;
if (count>100000000){
System.out.println("HightPriority is complete");
break;
}
}
}
}
}
public static class LowPriority extends Thread{
static int count = 0; @Override
public void run() {
while (true){
synchronized (PriorityDemo.class){
count++;
if (count>100000000){
System.out.println("LowPriority is complete");
break;
}
}
}
}
}
public static void main(String[] args){
HightPriority hightPriority = new HightPriority();
LowPriority lowPriority = new LowPriority();
hightPriority.setPriority(Thread.MAX_PRIORITY);//高优先级
lowPriority.setPriority(Thread.MIN_PRIORITY);//低优先级
lowPriority.start();
hightPriority.start();
}
//HightPriority is complete
//LowPriority is complete }

最新文章

  1. 查看sqlserver被锁的表以及如何解锁
  2. JointBoost+CRF+GraphCut做手绘草图的分割
  3. 手机QQ内置网页,微信内置网页中进行分享到QQ和微信的操作
  4. iOS开发拓展篇—CoreLocation定位服务
  5. poj 1724(有限制的最短路)
  6. Qt 5 如何修改打包好的应用程序图标
  7. jsp文件中的路径问题
  8. perl 爬取上市公司业绩预告
  9. Carmichael Numbers - PC110702
  10. TensorFlow 代码行统计
  11. nuget安装本地nupkg文件
  12. 【译】第二篇 SQL Server安全验证
  13. SVD与SVD++
  14. docker登录运行中的容器的4方案
  15. 【读书笔记】iOS-使用传感器
  16. BodeAbp服务端介绍
  17. Linux 创建文件系统及挂载文件系统流程详解(转)
  18. 使用LiteOrm删除数据对象失败的坑
  19. 基于vue的web应用如何构建成手机端的原生安装包
  20. Java编程语言下 Selenium 驱动各个浏览器代码

热门文章

  1. golang-练习1
  2. 【leetcode】433. Minimum Genetic Mutation
  3. Arthas阿里开源的 Java 诊断工具
  4. spring-boot整合Mybatis案例
  5. 四轴PID思路整理
  6. javascript中new关键字详解
  7. Axure RP 8.0软件安装教程
  8. APIO2010 特别行动队 & 斜率优化DP算法笔记
  9. soj#551 loj#2833 帐篷
  10. English-Words with 'ir'