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
Beginners Guide to DarkBASIC Game Programming (Premier Press Game Development)
Welcome to DarkBASIC
Making Programs Think Branching Statements and Subroutines
Basic Graphics Commands
Programming the Keyboard, Mouse, and Joystick
Playing Intro Movies and Cut-Scenes
Agile Project Management: Creating Innovative Products (2nd Edition)
Reliable Innovation
Agile Practices
Phase: Envision
Practice: Daily Interaction with the Customer Team
Phase: Close
Snort Cookbook
Invisibly Sniffing 100 MB Ethernet
Building a Distributed IDS (Encrypted)
Thresholding Alerts
Getting Performance Metrics
Passive OS Fingerprinting
Data Structures and Algorithms in Java
Implementing Stacks and Queues
Hash Tables
Strings
Summary
Vocabulary
HTI+ Home Technology Integrator & CEDIA Installer I All-In-One Exam Guide
Infrastructure Wiring Basics
Trim-Out Installation
Distributed Audio System Basics
Installing a Home Lighting Control System
Home Communication System Basics
Java Concurrency in Practice
Publication and Escape
Immutability
Synchronized Collections
Short-running GUI Tasks
Example: Comparing Map Performance
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