源码家

  • 开发语言:
  • Java
  • 源码大小:
  • 2.46M
  • 源码类别:
  • Java语言基础
  • 文件格式:
  • .pdf

源码介绍

【源码简介】Java Threads, Third Edition

【源码截图】

【核心源码】

Table Of Contents
1. Java Threads, Third Edition .............................................................................................................. 5
2. Table of Contents ............................................................................................................................. 5
3. Copyright ......................................................................................................................................... 8
4. Preface ............................................................................................................................................. 9
4.1 Who Should Read This Book .............................................................................................. 10
4.2 Versions Used in This Book .................................................................................................. 10
4.3 What's New in This Edition ................................................................................................ 11
4.4 Organization of This Book .................................................................................................... 13
4.5 Conventions Used in This Book ............................................................................................ 15
4.6 Code Examples ..................................................................................................................... 16
4.7 How to Contact Us ............................................................................................................... 16
4.8 Safari Enabled ...................................................................................................................... 17
4.9 Acknowledgments ............................................................................................................... 17
5. Chapter 1. Introduction to Threads ............................................................................................... 18
5.1 1.1 Java Terms ...................................................................................................................... 18
5.2 1.2 About the Examples ....................................................................................................... 21
5.3 1.3 Why Threads ................................................................................................................ 24
5.4 1.4 Summary ........................................................................................................................ 28
6. Chapter 2. Thread Creation and Management .............................................................................. 29
6.1 2.1 What Is a Thread .......................................................................................................... 29
6.2 2.2 Creating a Thread ........................................................................................................... 33
6.3 2.3 The Lifecycle of a Thread ............................................................................................... 48
6.4 2.4 Two Approaches to Stopping a Thread .......................................................................... 53
6.5 2.5 The Runnable Interface .................................................................................................. 58
6.6 2.6 Threads and Objects ...................................................................................................... 65
6.7 2.7 Summary ........................................................................................................................ 67
7. Chapter 3. Data Synchronization ................................................................................................... 69
7.1 3.1 The Synchronized Keyword ............................................................................................ 69
7.2 3.2 The Volatile Keyword ..................................................................................................... 73
7.3 3.3 More on Race Conditions .............................................................................................. 76
7.4 3.4 Explicit Locking ............................................................................................................... 84
7.5 3.5 Lock Scope ..................................................................................................................... 89
7.6 3.6 Choosing a Locking Mechanism ..................................................................................... 94
7.7 3.7 Nested Locks .................................................................................................................. 96
7.8 3.8 Deadlock ...................................................................................................................... 100
7.9 3.9 Lock Fairness ................................................................................................................ 109
7.10 3.10 Summary .................................................................................................................. 111
8. Chapter 4. Thread Notification .................................................................................................... 112
8.1 4.1 Wait and Notify ............................................................................................................ 113
8.2 4.2 Condition Variables ...................................................................................................... 123
更多IT编程类电子书尽在:https://shop109847659.taobao.com/或者加微信w33311w免费领取
Java Threads, Third Edition
2
8.3 4.3 Summary ...................................................................................................................... 128
9. Chapter 5. Minimal Synchronization Techniques......................................................................... 129
9.1 5.1 Can You Avoid Synchronization .................................................................................. 130
9.2 5.2 Atomic Variables .......................................................................................................... 136
9.3 5.3 Thread Local Variables ................................................................................................. 168
9.4 5.4 Summary ...................................................................................................................... 171
10. Chapter 6. Advanced Synchronization Topics ............................................................................ 172
10.1 6.1 Synchronization Terms ............................................................................................... 173
10.2 6.2 Synchronization Classes Added in J2SE 5.0 ................................................................ 174
10.3 6.3 Preventing Deadlock .................................................................................................. 182
10.4 6.4 Deadlock Detection ................................................................................................... 190
10.5 6.5 Lock Starvation .......................................................................................................... 211
10.6 6.6 Summary .................................................................................................................... 216
11. Chapter 7. Threads and Swing ................................................................................................... 217
11.1 7.1 Swing Threading Restrictions ..................................................................................... 217
11.2 7.2 Processing on the Event-Dispatching Thread ............................................................ 218
11.3 7.3 Using invokeLater( ) and invokeAndWait( ) ................................................................ 219
11.4 7.4 Long-Running Event Callbacks ................................................................................... 222
11.5 7.5 Summary .................................................................................................................... 227
12. Chapter 8. Threads and Collection Classes ................................................................................ 228
12.1 8.1 Overview of Collection Classes .................................................................................. 229
12.2 8.2 Synchronization and Collection Classes ..................................................................... 234
12.3 8.3 The Producer/Consumer Pattern ............................................................................... 245
12.4 8.4 Using the Collection Classes ...................................................................................... 249
12.5 8.5 Summary .................................................................................................................... 250
13. Chapter 9. Thread Scheduling .................................................................................................... 251
13.1 9.1 An Overview of Thread Scheduling ............................................................................ 252
13.2 9.2 Scheduling with Thread Priorities .............................................................................. 262
13.3 9.3 Popular Threading Implementations ......................................................................... 264
13.4 9.4 Summary .................................................................................................................... 272
14. Chapter 10. Thread Pools .......................................................................................................... 273
14.1 10.1 Why Thread Pools .................................................................................................. 273
14.2 10.2 Executors ................................................................................................................. 277
14.3 10.3 Using a Thread Pool ................................................................................................. 279
14.4 10.4 Queues and Sizes ..................................................................................................... 282
14.5 10.5 Thread Creation ....................................................................................................... 287
14.6 10.6 Callable Tasks and Future Results ............................................................................ 288
14.7 10.7 Single-Threaded Access ........................................................................................... 291
14.8 10.8 Summary .................................................................................................................. 293
15. Chapter 11. Task Scheduling ...................................................................................................... 294
15.1 11.1 Overview of Task Scheduling ................................................................................... 295
15.2 11.2 The java.util.Timer Class .......................................................................................... 296
15.3 11.3 The javax.swing.Timer Class ..................................................................................... 307
15.4 11.4 The ScheduledThreadPoolExecutor Class ................................................................ 312
更多IT编程类电子书尽在:https://shop109847659.taobao.com/或者加微信w33311w免费领取
Java Threads, Third Edition
3
15.5 11.5 Summary .................................................................................................................. 322
16. Chapter 12. Threads and I/O ..................................................................................................... 324
16.1 12.1 A Traditional I/O Server ........................................................................................... 325
16.2 12.2 A New I/O Server ..................................................................................................... 343
16.3 12.3 Interrupted I/O ........................................................................................................ 360
16.4 12.4 Summary .................................................................................................................. 365
17. Chapter 13. Miscellaneous Thread Topics ................................................................................. 367
17.1 13.1 Thread Groups ......................................................................................................... 367
17.2 13.2 Threads and Java Security ........................................................................................ 369
17.3 13.3 Daemon Threads ...................................................................................................... 372
17.4 13.4 Threads and Class Loading ....................................................................................... 373
17.5 13.5 Threads and Exception Handling ............................................................................. 374
17.6 13.6 Threads, Stacks, and Memory Usage ....................................................................... 379
17.7 13.7 Summary .................................................................................................................. 384
18. Chapter 14. Thread Performance .............................................................................................. 384
18.1 14.1 Overview of Performance ........................................................................................ 385
18.2 14.2 Synchronized Collections ......................................................................................... 387
18.3 14.3 Atomic Variables and Contended Synchronization .................................................. 389
18.4 14.4 Thread Creation and Thread Pools .......................................................................... 391
18.5 14.5 Summary .................................................................................................................. 392
19. Chapter 15. Parallelizing Loops for Multiprocessor Machines .................................................. 393
19.1 15.1 Parallelizing a Single-Threaded Program ................................................................. 394
19.2 15.2 Multiprocessor Scaling ............................................................................................. 437
19.3 15.3 Summary .................................................................................................................. 456
20. Appendix A. Superseded Threading Utilities ............................................................................. 458
20.1 A.1 The BusyFlag Class ..................................................................................................... 459
20.2 A.2 The CondVar Class ..................................................................................................... 461
20.3 A.3 The Barrier Class ........................................................................................................ 467
20.4 A.4 The RWLock Class ...................................................................................................... 469
20.5 A.5 The ThreadPool Class................................................................................................. 475
20.6 A.6 The JobScheduler Class ............................................................................................. 482
20.7 A.7 Summary ................................................................................................................... 492
21. Colophon ................................................................................................................................... 493
22. Index .......................................................................................................................................... 494
22.1 index_A ............................................................................................................................ 494
22.2 index_B ............................................................................................................................ 495
22.3 index_C ............................................................................................................................ 496
22.4 index_D ............................................................................................................................ 498
22.5 index_E ............................................................................................................................ 498
22.6 index_F ............................................................................................................................ 499
22.7 index_G ............................................................................................................................ 500
22.8 index_H ............................................................................................................................ 500
22.9 index_I ............................................................................................................................. 501
22.10 index_J ........................................................................................................................... 502
更多IT编程类电子书尽在:https://shop109847659.taobao.com/或者加微信w33311w免费领取
Java Threads, Third Edition
4
22.11 index_K .......................................................................................................................... 503
22.12 index_L ........................................................................................................................... 503
22.13 index_M ......................................................................................................................... 505
22.14 index_N .......................................................................................................................... 509
22.15 index_O .......................................................................................................................... 509
22.16 index_P .......................................................................................................................... 510
22.17 index_Q .......................................................................................................................... 511
22.18 index_R .......................................................................................................................... 511
22.19 index_S .......................................................................................................................... 512
22.20 index_T .......................................................................................................................... 515
22.21 index_U .......................................................................................................................... 517
22.22 index_V .......................................................................................................................... 518
22.23 index_W ......................................................................................................................... 519
更多IT编程类电子书尽在:https://shop109847659.taobao.com/或者加微信w33311w免费领取
Java Threads, Third Edition
5
1. Java Threads, Third Edition
• Table of Contents(See 2.)
• Index(See 22.)
• Reviews
• Reader Reviews
• Errata
• Academic
Java Threads, Third Edition
By Scott Oaks , Henry Wong
Publisher : O'Reilly
Pub Date : September 2004
ISBN : 0-596-00782-5
Pages : 360
Threads are essential to Java programming, but learning to use them effectively is a
nontrivial task. This new edition of the classic Java Threads shows you how to take full
advantage of Java's threading facilities and brings you up-to-date with the watershed
changes in Java 2 Standard Edition version 5.0 (J2SE 5.0). It provides a thorough,
step-by-step approach to threads programming.
2. Table of Contents
• Index(See 22.)
• Reviews
• Reader Reviews
• Errata
• Academic
Java Threads, Third Edition
By Scott Oaks , Henry Wong
Publisher : O'Reilly
Pub Date : September 2004
ISBN : 0-596-00782-5
Pages : 360
更多IT编程类电子书尽在:https://shop109847659.taobao.com/或者加微信w33311w免费领取
Java Threads, Third Edition
6
Copyright(See 3.)
Preface(See 4.)
Who Should Read This Book(See 4.1)
Versions Used in This Book(See 4.2)
What's New in This Edition(See 4.3)
Organization of This Book(See 4.4)
Conventions Used in This Book(See 4.5)
Code Examples(See 4.6)
How to Contact Us(See 4.7)
Safari Enabled(See 4.8)
Acknowledgments(See 4.9)
Chapter 1. Introduction to Threads(See 5.)
Section 1.1. Java Terms(See 5.1)
Section 1.2. About the Examples(See 5.2)
Section 1.3. Why Threads(See 5.3)
Section 1.4. Summary(See 5.4)
Chapter 2. Thread Creation and Management(See 6.)
Section 2.1. What Is a Thread(See 6.1)
Section 2.2. Creating a Thread(See 6.2)
Section 2.3. The Lifecycle of a Thread(See 6.3)
Section 2.4. Two Approaches to Stopping a Thread(See 6.4)
Section 2.5. The Runnable Interface(See 6.5)
Section 2.6. Threads and Objects(See 6.6)
Section 2.7. Summary(See 6.7)
Chapter 3. Data Synchronization(See 7.)
Section 3.1. The Synchronized Keyword(See 7.1)
Section 3.2. The Volatile Keyword(See 7.2)
Section 3.3. More on Race Conditions(See 7.3)
Section 3.4. Explicit Locking(See 7.4)
Section 3.5. Lock Scope(See 7.5)
Section 3.6. Choosing a Locking Mechanism(See 7.6)
Section 3.7. Nested Locks(See 7.7)
Section 3.8. Deadlock(See 7.8)
Section 3.9. Lock Fairness(See 7.9)
Section 3.10. Summary(See 7.10)
Chapter 4. Thread Notification(See 8.)
Section 4.1. Wait and Notify(See 8.1)
Section 4.2. Condition Variables(See 8.2)
Section 4.3. Summary(See 8.3)
Chapter 5. Minimal Synchronization Techniques(See 9.)
Section 5.1. Can You Avoid Synchronization(See 9.1)
Section 5.2. Atomic Variables(See 9.2)
Section 5.3. Thread Local Variables(See 9.3)
Section 5.4. Summary(See 9.4)
更多IT编程类电子书尽在:https://shop109847659.taobao.com/或者加微信w33311w免费领取
Java Threads, Third Edition
7
Chapter 6. Advanced Synchronization Topics(See 10.)
Section 6.1. Synchronization Terms(See 10.1)
Section 6.2. Synchronization Classes Added in J2SE 5.0(See 10.2)
Section 6.3. Preventing Deadlock(See 10.3)
Section 6.4. Deadlock Detection(See 10.4)
Section 6.5. Lock Starvation(See 10.5)
Section 6.6. Summary(See 10.6)
Chapter 7. Threads and Swing(See 11.)
Section 7.1. Swing Threading Restrictions(See 11.1)
Section 7.2. Processing on the Event-Dispatching Thread(See 11.2)
Section 7.3. Using invokeLater( ) and invokeAndWait( )(See 11.3)
Section 7.4. Long-Running Event Callbacks(See 11.4)
Section 7.5. Summary(See 11.5)
Chapter 8. Threads and Collection Classes(See 12.)
Section 8.1. Overview of Collection Classes(See 12.1)
Section 8.2. Synchronization and Collection Classes(See 12.2)
Section 8.3. The Producer/Consumer Pattern(See 12.3)
Section 8.4. Using the Collection Classes(See 12.4)
Section 8.5. Summary(See 12.5)
Chapter 9. Thread Scheduling(See 13.)
Section 9.1. An Overview of Thread Scheduling(See 13.1)
Section 9.2. Scheduling with Thread Priorities(See 13.2)
Section 9.3. Popular Threading Implementations(See 13.3)
Section 9.4. Summary(See 13.4)
Chapter 10. Thread Pools(See 14.)
Section 10.1. Why Thread Pools(See 14.1)
Section 10.2. Executors(See 14.2)
Section 10.3. Using a Thread Pool(See 14.3)
Section 10.4. Queues and Sizes(See 14.4)
Section 10.5. Thread Creation(See 14.5)
Section 10.6. Callable Tasks and Future Results(See 14.6)
Section 10.7. Single-Threaded Access(See 14.7)
Section 10.8. Summary(See 14.8)
Chapter 11. Task Scheduling(See 15.)
Section 11.1. Overview of Task Scheduling(See 15.1)
Section 11.2. The java.util.Timer Class(See 15.2)
Section 11.3. The javax.swing.Timer Class(See 15.3)
Section 11.4. The ScheduledThreadPoolExecutor Class(See 15.4)
Section 11.5. Summary(See 15.5)
Chapter 12. Threads and I/O(See 16.)
Section 12.1. A Traditional I/O Server(See 16.1)
Section 12.2. A New I/O Server(See 16.2)
Section 12.3. Interrupted I/O(See 16.3)
Section 12.4. Summary(See 16.4)
更多IT编程类电子书尽在:https://shop109847659.taobao.com/或者加微信w33311w免费领取
Java Threads, Third Edition
8
Chapter 13. Miscellaneous Thread Topics(See 17.)
Section 13.1. Thread Groups(See 17.1)
Section 13.2. Threads and Java Security(See 17.2)
Section 13.3. Daemon Threads(See 17.3)
Section 13.4. Threads and Class Loading(See 17.4)
Section 13.5. Threads and Exception Handling(See 17.5)
Section 13.6. Threads, Stacks, and Memory Usage(See 17.6)
Section 13.7. Summary(See 17.7)
Chapter 14. Thread Performance(See 18.)
Section 14.1. Overview of Performance(See 18.1)
Section 14.2. Synchronized Collections(See 18.2)
Section 14.3. Atomic Variables and Contended Synchronization(See 18.3)
Section 14.4. Thread Creation and Thread Pools(See 18.4)
Section 14.5. Summary(See 18.5)
Chapter 15. Parallelizing Loops for Multiprocessor Machines(See 19.)
Section 15.1. Parallelizing a Single-Threaded Program(See 19.1)
Section 15.2. Multiprocessor Scaling(See 19.2)
Section 15.3. Summary(See 19.3)
Appendix A. Superseded Threading Utilities(See 20.)
Section A.1. The BusyFlag Class(See 20.1)
Section A.2. The CondVar Class(See 20.2)
Section A.3. The Barrier Class(See 20.3)
Section A.4. The RWLock Class(See 20.4)
Section A.5. The ThreadPool Class(See 20.5)
Section A.6. The JobScheduler Class(See 20.6)
Section A.7. Summary(See 20.7)
Colophon(See 21.)
Index(See 22.

  • 商品评价
  • 交易规则
  • 交易流程

  • 发货方式

  • 1、自动:在上方保障服务中标有自动发货的商品,拍下后,将会自动收到来自卖家的商品获取(下载)链接;

    2、手动:未标有自动发货的的商品,拍下后,卖家会收到邮件、短信提醒,也可通过QQ或订单中的电话联系对方。

  • 交易周期

  • 1、源码默认交易周期:自动发货商品为1天,手动发货商品为3天,买家有1次额外延长3天交易周期的权利;

    2、若上述交易周期双方依然无法完成交易,任意一方可发起追加周期(1~7天)的请求,对方同意即可延长。

  • 退款说明

  • 1、描述:源码描述(含标题)与实际源码不一致的(例:描述PHP实际为ASP、描述的功能实际缺少、版本不符等);

    2、演示:有演示站时,与实际源码小于95%一致的(但描述中有"不保证完全一样、有变化的可能性"类似显著声明的除外);

    3、发货:手动发货源码,在卖家未发货前,已申请退款的;

    4、安装:免费提供安装服务的源码但卖家不履行的;

    5、收费:额外收取其他费用的(但描述中有显著声明或双方交易前有商定的除外);

    6、其他:如质量方面的硬性常规问题等。

    注:经核实符合上述任一,均支持退款,但卖家予以积极解决问题则除外。

  • 1注意事项

  • 1、源码家会对双方交易的过程及交易商品的快照进行永久存档,以确保交易的真实、有效、安全!

    2、源码家无法对如“永久包更新”、“永久技术支持”等类似交易之后的商家承诺做担保,请买家自行鉴别;

    3、在源码同时有网站演示与图片演示,且站演与图演不一致时,默认按图演作为纠纷评判依据(特别声明或有商定除外);

    4、在没有"无任何正当退款依据"的前提下,商品写有"一旦售出,概不支持退款"等类似的声明,视为无效声明;

    5、在未拍下前,双方在QQ上所商定的交易内容,亦可成为纠纷评判依据(商定与描述冲突时,商定为准);

    6、因聊天记录可作为纠纷评判依据,故双方联系时,只与对方在互站上所留的QQ、手机号沟通,以防对方不承认自我承诺。

    7、虽然交易产生纠纷的几率很小,但一定要保留如聊天记录、手机短信等这样的重要信息,以防产生纠纷时便于互站介入快速处理。

  • 互站声明

  • 1、源码家作为第三方中介平台,依据交易合同(商品描述、交易前商定的内容)来保障交易的安全及买卖双方的权益;

    2、非平台线上交易的项目,出现任何后果均与互站无关;无论卖家以何理由要求线下交易的,请联系管理举报。