修改getId为threadId。
This commit is contained in:
parent
12ad1d5a4b
commit
2e97a395c4
|
@ -12,7 +12,7 @@ package com.cpic.xim;
|
||||||
import com.cpic.xim.utils.MyThread;
|
import com.cpic.xim.utils.MyThread;
|
||||||
import com.cpic.xim.utils.MyWorkingJob;
|
import com.cpic.xim.utils.MyWorkingJob;
|
||||||
|
|
||||||
public class App
|
public class App
|
||||||
{
|
{
|
||||||
public static void main( String[] args )
|
public static void main( String[] args )
|
||||||
{
|
{
|
||||||
|
@ -22,6 +22,6 @@ public class App
|
||||||
workThread.start();
|
workThread.start();
|
||||||
jobThread.start();
|
jobThread.start();
|
||||||
|
|
||||||
System.out.println( "我是主线程!" + String.valueOf(Thread.currentThread().getId()) );
|
System.out.println( "我是主线程!" + String.valueOf( Thread.currentThread().threadId() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,6 @@ public class MyThread extends Thread
|
||||||
{
|
{
|
||||||
super.run();
|
super.run();
|
||||||
|
|
||||||
System.out.println("我是工作线程:" + String.valueOf(Thread.currentThread().getId()) );
|
System.out.println("我是工作线程:" + String.valueOf(Thread.currentThread().threadId()) );
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,6 +15,6 @@ public class MyWorkingJob implements Runnable
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
System.out.println("我是workingJob,ID是" + String.valueOf( Thread.currentThread().getId()));
|
System.out.println("我是workingJob,ID是" + String.valueOf( Thread.currentThread().threadId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue