Flylib.com
Java Thread Programming
Java Thread Programming
ISBN: 0672315858
EAN: 2147483647
Year: 2005
Pages: 149
Authors:
Paul Hyde
BUY ON AMAZON
Chapter 1: Introduction to Threads
Overview
What Is a Thread?
Why Use Multiple Threads?
When Multiple Threads Might Not Be Good
Javas Built-in Thread Support
Easy to Start, Tough to Master
Chapter 2: A Simple Two-Thread Example
Overview
Extending the java.lang.Thread Class
Overriding the run() Method
Spawning a New Thread
Putting It All Together
Summary
Chapter 3: Creating and Starting a Thread
Overview
Using Thread.currentThread()
Naming a Thread: getName() and setName()
Thread Constructors
Enlivening a Thread: start() and isAlive()
Using Thread.sleep()
Summary
Chapter 4: Implementing Runnable Versus Extending Thread
Overview
Visual Timer Graphical Component
Extending Thread and JComponent?
Interface java.lang.Runnable
Passing a Runnable Object to a Threads Constructor
Modifying SecondCounter to Use Runnable
Checking the Accuracy of SecondCounter
Improving the Accuracy of SecondCounter
Summary
Chapter 5: Gracefully Stopping Threads
Overview
Interrupting a Thread: interrupt()
Suspending and Resuming Thread Execution
Stopping a Thread
The Best Replacement for stop(), suspend(), and resume()
Daemon Threads
Summary
Chapter 6: Thread Prioritization
Overview
System Thread Priorities
Thread Priority Constants
Determining the Current Priority: getPriority()
Changing the Priority of a Thread: setPriority()
Thread States
Priorities and Scheduling
Voluntarily Relinquishing the Processor: Thread.yield()
Thread-Scheduling Scenarios
Summary
Chapter 7: Concurrent Access to Objects and Variables
Overview
volatile Member Variable Modifier
synchronized Method Modifier
synchronized Statement Block
static synchronized Methods
Using the Class-Level Lock in a synchronized Statement
Synchronization and the Collections API
Deadlocks
Speeding Concurrent Access
Summary
Chapter 8: Inter-thread Communication
Overview
The Need for Inter-thread Signaling
The WaitNotify Mechanism
Object API Used for WaitNotify
When to Use notifyAll() Instead of notify()
Missed Notification
Early Notification
CubbyHole Example
Using join() to Wait for a Thread to Die
Streaming Data Between Threads Using Pipes
Using ThreadLocal and InheritableThreadLocal
Summary
Chapter 9: Threads and Swing
Overview
Why Isnt the Swing Toolkit Multithread-Safe?
Using SwingUtilities.invokeAndWait()
Using SwingUtilities.invokeLater()
Using SwingUtilities.isEventDispatchThread()
When invokeAndWait() and invokeLater() Are Not Needed
The Need for Worker Threads in a GUI Setting
Using a Worker Thread to Relieve the Event Thread
Scrolling Text in a Custom Component
Animating a Set of Images
Displaying Elapsed Time on a JLabel
Floating Components Around Inside a Container
Summary
Chapter 10: Thread Groups
Overview
What Are Thread Groups?
Using getParent()
Finding the Subgroups of a Thread Group
Using the getThreadGroup() Method of Thread
Finding All the Threads in a Thread Group
Understanding Thread Group Security
Using setMaxPriority() and getMaxPriority()
Using interrupt()
Deprecated Methods: stop(), suspend(), and resume()
Class ThreadViewer
Summary
Chapter 11: Self-Running Objects
Overview
Simple Self-Running Class
Using an Inner Class to Hide run()
Additional Functionality to Consider
Summary
Chapter 12: Exception Callback
Overview
ExceptionListener Interface
Additional Methods to Support ExceptionListener
Summary
Chapter 13: Thread Pooling
Overview
Benefits of Thread Pooling
Considerations and Costs of Thread Pooling
A Generic Thread Pool: ThreadPool
A Specialized Worker Thread Pool: HttpServer
Summary
Chapter 14: Waiting for the Full Timeout
Overview
Accidentally Returning Early
Determining If wait() Should Be Invoked Again
A General-Purpose Wait-Until Pattern
Summary
Chapter 15: Breaking Out of a Blocked IO State
Overview
The read() Method Ignores Interrupts and Stop Requests
Closing a Stream to Break Out of the Blocked State
Throwing InterruptedIOException When Interrupted
Using BufferedThreadedInputStream for Interruptible IO
Summary
Chapter 16: The SureStop Utility
Overview
Guidelines for Using SureStop
The SureStop Class
Peering Inside Using SureStopVerbose
Watching It Work with SureStopDemo
Summary
Chapter 17: The BooleanLock Utility
Overview
Background
BooleanLock Class
Inter-Thread Signaling Using BooleanLock
Avoiding Blocking on synchronized
Noticing Brief Changes in Value Using TransitionDetector
Summary
Chapter 18: First-In-First-Out (FIFO) Queue
Overview
How a FIFO Queue Works
Implementing a FIFO with an Array
Simple Implementation in Java: SimpleObjectFIFO
An Expanded FIFO Queue for Object References: ObjectFIFO
A FIFO Queue for Bytes: ByteFIFO
Summary
Appendix A: The Thread API
Overview
Member Variables
Constructors
static methods
Instance Methods
Deprecated Methods
Appendix B: The ThreadGroup API
Overview
Constructors
Instance Methods
Java Thread Programming
ISBN: 0672315858
EAN: 2147483647
Year: 2005
Pages: 149
Authors:
Paul Hyde
BUY ON AMAZON
Lotus Notes and Domino 6 Development (2nd Edition)
Creating Your Own Templates
Adding an Outline to a Frameset
Enabling Physical Security
Setting Server Access
Document Tags
Visual C# 2005 How to Program (2nd Edition)
Early Operating Systems
Introduction
User-Defined Controls
Exercises
Self-Referential Classes
Postfix: The Definitive Guide
Postfix Components
Postfix and DNS
Mail Relaying
C.2. Postfix Compiling Primer
Appendix D. Frequently Asked Questions
Cisco CallManager Fundamentals (2nd Edition)
Circuit-Switched Systems
Regions
Definition of Station Devices
Architecture and Functionality of the Media Control Layer
Understanding Field Data in CMRs
Practical Intrusion Analysis: Prevention and Detection for the Twenty-First Century: Prevention and Detection for the Twenty-First Century
Understanding Intrusion Detection
Unauthorized Activity II
Tcpdump
Policy and Procedures
The Future of Intrusion Detection and Prevention
Special Edition Using FileMaker 8
Working with Entities and Attributes
Working with Multiple Files
FileMaker Extra: Portals and Record Locking
File Maintenance and Recovery
Working with Large Fields and Container Fields
flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net
Privacy policy
This website uses cookies. Click
here
to find out more.
Accept cookies