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
MySQL Stored Procedure Programming
Parameters
Conclusion
Using MySQL Stored Programs with Perl
Using MySQL Stored Programs with .NET
How MySQL Processes SQL
OpenSSH: A Survival Guide for Secure Shell Handling (Version 1.0)
Step 3.2 Use PuTTY / plink as a Command Line Replacement for telnet / rlogin
Step 4.4 How to Generate a Key Using PuTTY
Step 4.7 Using Public Key Authentication for Automated File Transfers
Step 5.2 Troubleshooting Common OpenSSH Errors/Problems
Step 6.2 Using Port Forwarding Within PuTTY to Read Your E-mail Securely
FileMaker Pro 8: The Missing Manual
Switching Between Layouts
Creating Layouts for Reports
Sorting Records
Working with Windows
Exporting a File
Practical Intrusion Analysis: Prevention and Detection for the Twenty-First Century: Prevention and Detection for the Twenty-First Century
Unauthorized Activity I
Incident Response
Policy and Procedures
Laws, Standards, and Organizations
The Future of Intrusion Detection and Prevention
Quantitative Methods in Project Management
Project Value: The Source of all Quantitative Measures
Introduction to Probability and Statistics for Projects
Expense Accounting and Earned Value
Quantitative Time Management
Special Topics in Quantitative Management
GDI+ Programming with C#
Transformation with Brushes
Rectangles and Regions
Working with Metafiles
The Graphics Class and Transformation
Text Transformation
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