Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Java General Java Thread states Tutorial

List of available thread states.

Tutorial Details:

Java Thread states

Threads can be in one of the following states:

1. New. After the thread is instantiated, the thread is in the New state until the start() method is invoked. In this state, the thread is not considered alive.

2. Runnable. A thread comes into the runnable state when the start() method is invoked on it. It can also enter the runnable state from the running state or blocked state. The thread is considered alive when it is in this state.

3. Running. A thread moves from the runnable state into the running state when the thread scheduler chooses it to be the currently running thread.
Alive, but not runnable. A thread can be alive but not in a runnable state for a variety of reasons. It may be waiting, sleeping, or blocked.

4. Waiting. A thread is put into a waiting state by calling the wait() method. A call to notify() or notifyAll() may bring the thread from the waiting state into the runnable state. The sleep() method puts the thread into a sleeping state for a specified amount of time in milliseconds, as follows:

try {
Thread.sleep(3 * 60 * 1000); // thread sleeps for 3 minutes
} catch(InterruptedException ex){}


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Java General Java Thread states Tutorial

View Tutorial:
Java General Java Thread states Tutorial

Related Tutorials:

Exceptions in Java - JavaWorld - July 1998
Exceptions in Java - JavaWorld - July 1998
 
Cleaning up after Jini services - JavaWorld March 2000
Cleaning up after Jini services - JavaWorld March 2000
 
Make a sweep with clean beans - JavaWorld November 1999
Make a sweep with clean beans - JavaWorld November 1999
 
Activatable Jini services, Part 2: Patterns of use - JavaWorld October 2000
Activatable Jini services, Part 2: Patterns of use - JavaWorld October 2000
 
Master Java with these introductory books - JavaWorld May 2001
Master Java with these introductory books - JavaWorld May 2001
 
I want my AOP!, Part 3
I want my AOP!, Part 3
 
Achieve strong performance with threads, Part 1
Achieve strong performance with threads, Part 1
 
Achieve strong performance with threads, Part 2
Achieve strong performance with threads, Part 2
 
Java Tip 132: The taming of the thread
Java Tip 132: The taming of the thread
 
The Java Web Services Tutorial
This tutorial is a beginner\'s guide to developing Web services and Web applications using the Java Web Services Developer Pack (Java WSDP).
 
JDBC scripting, Part 2
JDBC scripting, Part 2 Programming and Java scripting in JudoScript Summary JudoScript is a rich functional scripting language, and an easy and powerful general programming and Java scripting language. JudoScript's power comes from its synergy of
 
ehcache
Overview Ehcache is a pure Java, in-process cache with the following features: Fast Simple Acts as a pluggable cache for Hibernate 2.1. Small foot print. Both in terms of size and memory requirements. Minimal dependencies. Fully documented. S
 
The JDBC RowSet Implementations Tutorial
In "The JDBC RowSet Implementations Tutorial," you will look at how to use the standard JDBC RowSet implementations specified in JSR-114.
 
Java Servlets: Design Issues
This article covers the principal concepts associated with servlets. This article examines some of the design issues, and offers some guidelines on the applicability of Java servlets for web based application development.
 
Servlet Essentials
This document explains the concepts of Java Servlets and provides a step-by-step tutorial for writing HTTP Servlets with complete source code for the example Servlets. The tutorial and the other chapters cover all facets of Servlet programming from a ...
 
The JavaTM Web Services Tutorial
A beginner's guide to developing Web services and Web applications on the Java Web Services Developer Pack
 
JSP Tutorial
This Tutorial is for beginners in the Java Server Pages Technology
 
JavaServer Pages Technology - Documentation
Sun's tutorial for Java Server Pages that provide a good introduction to design web pages with JSP.
 
Generating an XML Document with JAXB
In this tutorial, JAXB is used to generate Java classes from an XML Schema. An example XML document shall be created from the Java classes.
 
Understanding Network Class Loaders Class loaders
One of the cornerstones of Java dynamics, determine when and how classes can be added to a running Java environment.
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.