Getting and setting thread information

The Thread class saves some information attributes that can help us to identify a thread, know its status, or control its priority. These attributes are:

  • ID: This attribute stores a unique identifier for each Thread.
  • Name: This attribute store the name of Thread.
  • Priority: This attribute stores the priority of the Thread objects. Threads can have a priority between one and 10, where one is the lowest priority and 10 is the highest one. It's not recommended to change the priority of the threads, but it's a possibility that you can use if you want.
  • Status: This attribute stores the status of Thread. In Java, Thread can be in one of these six states: new, runnable, blocked, waiting, timewaiting, or terminated. ...

Get Java 7 Concurrency Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.