img
. . . . .
Reference:
Chapter 4.
Comment:
Deprecated in Java 1.1. See ThreadGroup.allThreads().
The Interface java.lang.Runnable
This interface provides the building blocks for threads. You implement this interface, define a
run() method on the class, and pass an instance of it to the thread.
run
public void run()
This is the method you define that actually executes the code you want.
Reference:
Chapter 4.
Comment:
This is the only way to start anything.
The Class java.lang.Object
All objects have a lock and wait set associated with them.
synchronized
synchronized
This language keyword causes the current thread to obtain the hidden lock for the object. If the
lock is already held by the current thread, it will essentially increment a counter for that lock (it's a
recursive lock). If the lock is held by a different thread, this thread will go to sleep waiting for it to
become available.
Chapter 6.
Reference:
wait
public void wait()
throws InterruptedException
This causes the current thread to block until it is awakened by either a call to notify(),
interruption, or by a spurious wakeup. It will release the synchronization lock for the object as it
goes to sleep and reacquire it before returning.
Reference:
Chapter 6.
notify notifyAll
public void notify()
public void notifyAll()
These cause (one/all) of the threads that are in a wait() call for this object to wake up and return.
Reference:
Chapter 6.
Search WWH :
Custom Search
Previous Page
Multithreaded Programming with JAVA - Topic Index
Next Page
Multithreaded Programming with JAVA - Bookmarks
Home