O'Reilly logo

Quality Code: Software Testing Principles, Practices, and Patterns by Stephen Vance

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Test the Thread Task Directly

Object-oriented threading libraries generally separate the modeling of a thread from the modeling of the task that the thread runs. Usually, there are also convenience facilities to just use the thread model directly rather than explicitly creating separate instances for each. From its inception, Java has had a Thread class and has represented the task with the Runnable interface. A Thread is a Runnable, and its default implementation runs itself as its task.

Shortcomings in this design3 motivated the addition of the java.util.concurrent packages to Java 5. In addition to a broad range of new synchronization facilities, it added Executor as the model of execution and Callable as the model for the task. The new packages ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required