thread stopping & blocking in java

Stopping a thread:

Whenever we want to stop a thread from running further,we may do so by calling its stop() method, like:

This statement cause the thread to move to the dead state.The stop method may used when the premature death of a thread is desired.

Blocking a thread:
A thread can also be temporarily suspended or blocked from entering into the runnable and subsequently running state by using either of the following thread methods:
//blocked for a specified time

//blocked until further orders

//blocked until certain condition occurs
These methods cause the thread to go into the blocked(or not-runnable) state.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s