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

4.3 Summary - Java Threads, Third Edition

Previous Section  < Day Day Up >  Next Section

4.3 Summary

In this chapter, we introduced the methods of the wait-and-notify mechanism. We also examined the Condition interface, which provides a notification counterpart for the Lock interface.

With these methods of the Object class and Condition interface, threads are able to interoperate efficiently. Instead of just providing protection against race conditions, we now have ways for threads to inform each other about events or conditions without resorting to polling and timeouts.

In later chapters, we examine classes and techniques that provide even higher level support for data synchronization and thread communication.

4.3.1 Example Classes

Here are the class names and Ant targets for the examples in this chapter:

Description

Main Java class

Ant target

Swing Type Tester with wait-and-notify mechanism

javathreads.examples.ch04.example1.SwingTypeTester

ch4-ex1

Swing Type Tester with wait-and-notify mechanism in synchronized blocks

javathreads.examples.ch04.example2.SwingTypeTester

ch4-ex2

Swing Type Tester with condition variables

javathreads.examples.ch04.example3.SwingTypeTester

ch4-ex3


    Previous Section  < Day Day Up >  Next Section