站内搜索: 请输入搜索关键词
当前页面: 图书首页 > Java Threads, Third Edition

8.5 Summary - Java Threads, Third Edition

Previous Section  < Day Day Up >  Next Section

8.5 Summary

In this chapter, we have examined how threads interact with Java's collection classes. We've seen the synchronization requirements imposed by different classes and how to handle those requirements effectively. We've also examined how these classes can be used for the common design pattern known as the producer/consumer pattern.

8.5.1 Example Classes

Here are the class names and Ant targets for the examples in this chapter. The online examples also include test code for the producer/consumer pattern.

Description

Main Java class

Ant target

Swing Type Tester

javathreads.examples.ch08.example1.SwingTypeTester

ch8-ex1

Swing Type Tester (uses array lists)

javathreads.examples.ch08.example2.SwingTypeTester

ch8-ex2

Swing Type Tester (uses synchronized blocks)

javathreads.examples.ch08.example3.SwingTypeTester

ch8-ex3

SwingTypeTester (counts character success/failures)

javathreads.examples.ch08.example4.SwingTypeTester

ch8-ex4

SwingTypeTester (uses enumeration)

javathreads.examples.ch08.example5.SwingTypeTester

ch8-ex5

Producer/Consumer Model

javathreads.examples.ch08.example6.FibonacciTest nConsumers

ch8-ex6


In the Ant script, the number of consumer threads is defined by this property:

<property name="nConsumers" value="1"/>

    Previous Section  < Day Day Up >  Next Section