O'Reilly logo

Java 9 Concurrency Cookbook - Second Edition by Javier Fernández González

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

In this recipe, you have used the following methods to get information about a Thread class:

  • getId(): This method returns the ID of a thread. It's a unique long number and it can't be changed.
  • getName(): This method returns the name of a thread. If you don't establish the name of the thread, Java gives it a default name.
  • getPriority(): This method returns the priority of execution of a thread. Threads with higher priority are executed in preference to threads with lower priority. It's an int value that has a value between the MIN_PRIORITY and MAX_PRIORITY constants of the Thread class. By default, threads are created with the same priority that specified by the constant NORM_PRIORITY of the Thread class.
  • getState(): This ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required