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
VBScript Programmers Reference
A Quick Introduction to Programming
Control of Flow
Remote Scripting
Appendix E VBScript Error Codes and the Err Object
Appendix F The Scripting Runtime Library Object Reference
Adobe After Effects 7.0 Studio Techniques
The Many Ways to Create Selections
Linking Animation Data
Dynamic Range
Water
Pyrotechnics: Fire, Explosions, Energy Phenomena
Systematic Software Testing (Artech House Computer Library)
Master Test Planning
Test Execution
The Software Tester
Appendix E Simplified Unit Test Plan
Appendix F Process Diagrams
Introduction to 80x86 Assembly Language and Computer Architecture
Branching and Looping
Bit Manipulation
Floating-Point Arithmetic
Input/Output
Appendix A Hexadecimal/ASCII conversion
What is Lean Six Sigma
The Four Keys to Lean Six Sigma
Key #3: Work Together for Maximum Gain
Key #4: Base Decisions on Data and Facts
Beyond the Basics: The Five Laws of Lean Six Sigma
Making Improvements That Last: An Illustrated Guide to DMAIC and the Lean Six Sigma Toolkit
Quartz Job Scheduling Framework: Building Open Source Enterprise Applications
Creating a Fire-Now Trigger
Configuring Datasources for JobStoreCMT
What Is a Plug-In?
If I Have J2EE, Why Do I Need Quartz?
The Main Quartz Properties
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