|
volatile
and synchronized
should be used to control concurrent access to objects and variables and how to avoid deadlocks.
Thread
,
ThreadGroup
, ThreadLocal
,
and InheritableThreadLocal
.
|
java.lang.Thread
class
run()
method
Thread.currentThread()
setName()
and getName()
start()
and isAlive()
Thread.sleep()
Runnable
versus Extending Thread
- (26 pages)
SecondCounter
Thread
and JComponent
?
java.lang.Runnable
Runnable
object
to a Thread
's constructor
SecondCounter
to use Runnable
SecondCounter
SecondCounter
interrupt()
stop()
, suspend()
,
and resume
getPriority()
setPriority()
Thread.yield()
volatile
member variable modifier
synchronized
method modifier
synchronized
statement block
static synchronized
methods
synchronized
block
Object
API used for wait-notify
notifyAll()
instead of notify()
CubbyHole
example
join()
to wait for a thread to die
ThreadLocal
and InheritableThreadLocal
SwingUtilities.invokeAndWait()
SwingUtilities.invokeLater()
SwingUtilities.isEventDispatchThread()
invokeAndWait()
and invokeLater()
are not needed
JLabel
getThreadGroup()
method of Thread
setMaxPriority()
interrupt()
stop()
, suspend()
,
and resume()
getParent()
activeCount()
ThreadViewer
run()
JComponent
ExceptionListener
interface
ExceptionListener
ThreadPool
HttpServer
wait()
should be invoked again
read()
method ignores interrupts and stop requests
InterruptedException
when interrupted
BufferedThreadedInputStream
for
interruptible I/O
SureStop
Utility - (20 pages)
SureStop
SureStop
class
SureStopVerbose
SureStopDemo
BooleanLock
Utility - (22 pages)
BooleanLock
class
BooleanLock
synchronized
SimpleObjectFIFO
ObjectFIFO
ByteFIFO
|
JavaThreadProgrammingCode.zip
[109 kB; All classes now in packages (line numbers have
changed slightly); Eclipse Project Ready]JavaThreadProgramming_src.zip
[100 kB; Exactly matching book—no packages]JavaThreadProgramming_src.tar.gz
[44 kB; Exactly matching book—no packages][ccc]
[ccc]
" which
should have been replaced by a continuation line arrow (see page 44,
line 56 for an example) by the copy editor.
The [ccc]
text should be completely
ignored. The downloadable source code does
not have this typo.wait(long, int)