Java Multithreading, Concurrency, and Parallelism — Part 3

KRISHNA KISHORE V
4 min readJul 6, 2021

Life Cycle of a thread with Methods in Thread Class

For managing threads in java, we have many static and instance methods in the Thread class. We can use these methods for creating, starting, pausing, and stopping threads.

Static Methods

  1. static int activeCount()
  2. static Thread currentThread()
  3. static void dumpStack()
  4. static boolean interrupted()
  5. static void sleep()
  6. static void yield()

Instance Methods

  1. void start()
  2. long getId()
  3. String getName()
  4. int getPriority()
  5. void interrupt()
  6. boolean isInterrupted()
  7. boolean isAlive()
  8. void join()
  9. String toString()

This is not the complete list and we will not even cover all of the above. There are other methods but we don’t really need them unless we build some tiny multithreading frameworks ourselves.

Here in this article, we will discuss the methods related to the lifecycle of threads in Java:start() and sleep(). We will also discuss some of the states in the thread’s lifecycle.

--

--

KRISHNA KISHORE V

Full Stack Tech Lead | Software Consultant | Technical Content Writer