Using Threads to Give Other Tasks a Chance .......................
Thread States .............................................................................................
Runnable Threads ......................................................................
Terminated Threads ..................................................................
Thread Priorities ........................................................................
ptg18360597
859
Daemon Threads ........................................................................
14.4.2
860
Handlers for Uncaught Exceptions ........................................
14.4.3
862
Synchronization .......................................................................................
14.5
862
An Example of a Race Condition ............................................
14.5.1
866
The Race Condition Explained ................................................
14.5.2
868
Lock Objects ...............................................................................
14.5.3
872
Condition Objects ......................................................................
14.5.4
878
The
synchronized
Keyword ............................................................
14.5.5
882
Synchronized Blocks .................................................................
14.5.6
884
The Monitor Concept ................................................................
14.5.7
885
Volatile Fields .............................................................................
14.5.8
886
Final Variables ............................................................................
14.5.9
886
Atomics .......................................................................................
14.5.10
889
Deadlocks ...................................................................................
14.5.11
892
Thread-Local Variables .............................................................
14.5.12
893
Lock Testing and Timeouts ......................................................
14.5.13
895
Read/Write Locks .....................................................................
14.5.14
896
Why the
stop
and
suspend
Methods Are Deprecated ...............
14.5.15
898
Blocking Queues ......................................................................................
14.6
905
Thread-Safe Collections ..........................................................................
14.7
905
Efficient Maps, Sets, and Queues ............................................
14.7.1
907
Atomic Update of Map Entries ................................................
14.7.2
909
Bulk Operations on Concurrent Hash Maps .........................
14.7.3
912
Concurrent Set Views ...............................................................
14.7.4
912
Copy on Write Arrays ...............................................................
14.7.5
912
Parallel Array Algorithms ........................................................
14.7.6
914
Older Thread-Safe Collections .................................................
14.7.7
915
Callables and Futures ..............................................................................
14.8
920
Executors ...................................................................................................
14.9
921
Thread Pools ...............................................................................
14.9.1
926
Scheduled Execution .................................................................
14.9.2
927
Controlling Groups of Tasks ....................................................
14.9.3
928
The Fork-Join Framework ........................................................
14.9.4
931
Completable Futures .................................................................
14.9.5
934
Synchronizers ...........................................................................................
14.10
xvii
Contents
From the Library of Hristo Dimov Hristov
ptg18360597
935
Semaphores ................................................................................
14.10.1
936
Countdown Latches ..................................................................
14.10.2
936
Barriers ........................................................................................
14.10.3
937
Exchangers .................................................................................
14.10.4
937
Synchronous Queues ................................................................
14.10.5
937
Threads and Swing ..................................................................................
14.11
939
Running Time-Consuming Tasks ............................................
14.11.1
943
Using the Swing Worker ..........................................................
14.11.2
951
The Single-Thread Rule ............................................................
14.11.3
Do'stlaringiz bilan baham: