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
Project Management JumpStart
Building the Foundation
Breaking Down the Project Activities
Assessing Risk
Closing the Books
Appendix C Sample Project Management Checklists
Image Processing with LabVIEW and IMAQ Vision
Image Acquisition
Image Distribution
Gray-Scale Operations
Spatial Image Filtering
Frequency Filtering
Practical Intrusion Analysis: Prevention and Detection for the Twenty-First Century: Prevention and Detection for the Twenty-First Century
Understanding Intrusion Detection
IDS and IPS Internals
Incident Response
Security Business Issues
The Future of Intrusion Detection and Prevention
Twisted Network Programming Essentials
Finding Answers to Your Questions
Storing Web Data in an SQL Database
Using the REST Architecture for Web Services
Calling SOAP Web Services
Authenticating Against a Database Table
Ruby Cookbook (Cookbooks (OReilly))
Handling Commercial Dates
Writing a Method That Accepts a Block
Hiding Setup and Cleanup in a Block Method
Charging a Credit Card
Automatically Building a Gem
Visual Studio Tools for Office(c) Using C# with Excel, Word, Outlook, and InfoPath
Working with the Names Collection and Name Object
Conclusion
.NET Code Security
Creating Setup Packages
Moving Away from COM Add-Ins
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