修改getId为threadId。
This commit is contained in:
		@@ -22,6 +22,6 @@ public class App
 | 
			
		||||
        workThread.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();
 | 
			
		||||
 | 
			
		||||
        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
 | 
			
		||||
    public void run()
 | 
			
		||||
    {
 | 
			
		||||
        System.out.println("我是workingJob,ID是" + String.valueOf( Thread.currentThread().getId()));
 | 
			
		||||
        System.out.println("我是workingJob,ID是" + String.valueOf( Thread.currentThread().threadId()));
 | 
			
		||||
    }
 | 
			
		||||
} 
 | 
			
		||||
		Reference in New Issue
	
	Block a user