The Java threads ebook explains how Thread and Runnable classes work to run threaded programs and makes sense of run(), start(), wait() and sleep() methods.
What if you were One Percent Better with Java threads?
* You're eager to write your next Runnable class
* You use threads like gift wrap for your apps
* Thread safety has meaning, the volatile keyword has purpose
* You sleep easily with thread methods, not run in fear
* You know when to synchronize, when to wait and notify
What's inside the Java threads ebook?
* 27 core Java thread questions and answers
* 10 extra Java threads answers from other FAQs
The Java threads FAQ ebook helps you solve problems like these.
Threads and runnable types
What's the difference between Thread and Runnable types?
Learn how threads and runnable classes work in multi-threaded programs.
How does the run() method in Runnable work?
Get threaded programs to carry on running with a continuous run method.
* What is a Runnable object and a Runnable argument?
* Do Thread and Runnable types have their own run() methods?
* Why not override Thread to make a Runnable?
* When could I adapt the Thread class though?
The start() method
What's the difference between a thread's start() and run() methods?
If your start() method only runs once, you need to learn how the start method works.
* Can I implement my own start() method?
Thread management methods
Which class is the sleep(long) method defined in?
Make a thread sleep and you will begin to see how thread management works.
* Which class is the wait() method defined in?
* Why are wait(), notify() and notifyall() methods defined in the Object class?
* Why are there separate wait and sleep methods?
Multi-threaded design questions
If all methods are synchronized, is a class thread safe?
The synchronized keyword is not the last word in thread safety.
Which has priority with a static synchronized thread?
Choose the right monitor object to prevent unexpected behaviour in static methods.
* Do I need to use synchronized on setValue(int)?
* How do I create a Runnable with inheritance?
* What is the volatile modifier for?
* What is the SwingUtilities.invokeLater(Runnable) method for?
Multi-threaded design patterns
What is a working thread?
Could a worker thread pool be the answer to your problem?
Thread programming jargon
What is a green thread?
Old Java books talk about green threads, see if they are relevant to your project.
* What are native operating system threads?
Thread programming problems
Apache Log4J has thrown a ThreadDeath error!
Sounds serious, but what is a thread death error and what to do?
* I get “incompatible return type” for my thread's getState() method!
Extra Java threads answers
The Java threads ebook includes 10 extra Java thread-related answers from ten other Java FAQs.
* Is the DriverManager thread safe?
* Is the Struts 1.x Action thread safe or not?
* Does JSP support multi-threading?
* How many objects exist when a JSP has concurrent requests?
* Why do we only use the main() method to start a program?
* How can I find the inherited attributes of a class?
* How can I count the number of instances of an object?
* How does the JVM execute a servlet compared with a regular Java class?
* What is the difference between Hashtable and HashMap?