26.3. Displaying Date and Time

 
[Page 771]
The Goddess Chalchihuitlicue, found in the Valley of Mexico, 1300-1500 AD (stone), Aztec / Muse de l'Homme, Paris, France / Bridgeman Art Library

This part of the book is devoted to three unique and useful features of Java. Chapter 24 treats the use of multithreading to make programs more responsive and interactive. Chapter 25 introduces how to write programs that talk with each other from different hosts over the Internet. Chapter 26 covers the use of internationalization support to develop projects for international audiences.


[Page 772]

Prerequisites for Part 6

Chapter 24, "Multithreading," or Chapter 26, "Internationalization," can be covered after Chapter 16, "Applets and Multimedia." Chapter 25, "Networking," is dependent on Chapter 24, "Multithreading," and Chapter 18, "Binary I/O."


 

Chapter 24 Multithreading

 

Chapter 25 Networking

 

Chapter 26 Internationalization

[Page 773]

Chapter 24. Multithreading

Mayan God Shel, Mexico. Photographer: Philip Coblentz. Courtesy Brand X Pictures.

Objectives

  • To understand the concept of multithreading and apply it to develop concurrent programs (24.2).

  • To develop task classes by implementing the Runnable interface (24.3).

  • To create threads to run tasks using the Thread class (24.3).

  • To control threads using the methods in the Thread class (24.4).

  • To control animations using threads (24.5, 24.7).

  • To run code in the event dispatcher thread (24.6).

  • To execute tasks in a thread pool (24.8).

  • To use synchronized methods or blocks to synchronize threads to avoid race conditions (24.9).

  • To synchronize threads using locks (24.10).

  • To facilitate thread communications using conditions on locks (24.1124.12).

  • (Optional) To use blocking queues to synchronize access to an array queue, linked queue, and priority queue (24.13).

  • (Optional) To restrict the number of accesses to a shared resource using semaphores (24.14).

  • (Optional) To use the resource-ordering technique to avoid deadlocks (24.15).

  • To understand the life cycle of a thread (24.16).

  • To create synchronized collections using the static methods in the Collections class (24.17).

  • (Optional) To display the completion status of a task using JProgressBar (24.18).


[Page 774]

24.1. Introduction

One of the powerful features of Java is its built-in support for multithreading. Multithreading is the capability of running multiple tasks concurrently within a program. In many programming languages, you have to invoke system-dependent procedures and functions to implement multithreading. This chapter introduces the concepts of threads and how to develop multithreading programs in Java.

 


Introduction to Java Programming-Comprehensive Version
Introduction to Java Programming-Comprehensive Version (6th Edition)
ISBN: B000ONFLUM
EAN: N/A
Year: 2004
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net