标签:access .exe his plugin 启动 idg color bin dea
jdk中有3个常量来定义优先级
public final static int MIN_PRIOPITY = 1;
public final static int NORM_PRIOPITY = 5;
public final static int MAX_PRIOPITY = 10;
在java中,线程的优先级具有继承性,比如A线程启动B线程,则B线程的优先级和A时一样的
测试
1 package com.cky.demo; 2 3 /** 4 * Created by edison on 2017/12/3. 5 */ 6 public class MyThread1 extends Thread{ 7 @Override 8 public void run() { 9 super.run(); 10 System.out.println("线程1:"+ this.getPriority()); 11 Thread2 thread2 = new Thread2(); 12 thread2.start(); 13 } 14 }
1 package com.cky.demo; 2 3 /** 4 * Created by edison on 2017/12/3. 5 */ 6 public class Thread2 extends Thread { 7 @Override 8 public void run() { 9 System.out.println("线程2:"+ this.getPriority()); 10 } 11 }
1 package com.cky.demo; 2 3 /** 4 * Created by edison on 2017/12/3. 5 */ 6 public class TestDemo { 7 public static void main(String[] args) { 8 System.out.println("main " + Thread.currentThread().getPriority()); 9 //Thread.currentThread().setPriority(6); 10 System.out.println("main " + Thread.currentThread().getPriority()); 11 MyThread1 th = new MyThread1(); 12 th.start(); 13 } 14 }
C:\itsoft\jdk\bin\java -Didea.launcher.port=7539 "-Didea.launcher.bin.path=C:\itsoft\idea\IntelliJ IDEA 2016.3.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\itsoft\jdk\jre\lib\charsets.jar;C:\itsoft\jdk\jre\lib\deploy.jar;C:\itsoft\jdk\jre\lib\ext\access-bridge-32.jar;C:\itsoft\jdk\jre\lib\ext\cldrdata.jar;C:\itsoft\jdk\jre\lib\ext\dnsns.jar;C:\itsoft\jdk\jre\lib\ext\jaccess.jar;C:\itsoft\jdk\jre\lib\ext\jfxrt.jar;C:\itsoft\jdk\jre\lib\ext\localedata.jar;C:\itsoft\jdk\jre\lib\ext\nashorn.jar;C:\itsoft\jdk\jre\lib\ext\sunec.jar;C:\itsoft\jdk\jre\lib\ext\sunjce_provider.jar;C:\itsoft\jdk\jre\lib\ext\sunmscapi.jar;C:\itsoft\jdk\jre\lib\ext\sunpkcs11.jar;C:\itsoft\jdk\jre\lib\ext\zipfs.jar;C:\itsoft\jdk\jre\lib\javaws.jar;C:\itsoft\jdk\jre\lib\jce.jar;C:\itsoft\jdk\jre\lib\jfr.jar;C:\itsoft\jdk\jre\lib\jfxswt.jar;C:\itsoft\jdk\jre\lib\jsse.jar;C:\itsoft\jdk\jre\lib\management-agent.jar;C:\itsoft\jdk\jre\lib\plugin.jar;C:\itsoft\jdk\jre\lib\resources.jar;C:\itsoft\jdk\jre\lib\rt.jar;C:\多线程核心技术\第一章\out\production\第一章;C:\itsoft\idea\IntelliJ IDEA 2016.3.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.cky.demo.TestDemo main 5 main 5 线程1:5 线程2:5
当去掉注释
package com.cky.demo; /** * Created by edison on 2017/12/3. */ public class TestDemo { public static void main(String[] args) { System.out.println("main " + Thread.currentThread().getPriority()); Thread.currentThread().setPriority(6); System.out.println("main " + Thread.currentThread().getPriority()); MyThread1 th = new MyThread1(); th.start(); } }
main 5 main 6 线程1:6 线程2:6
标签:access .exe his plugin 启动 idg color bin dea
原文地址:http://www.cnblogs.com/edison20161121/p/7954800.html