文件名称:Java 7 Concurrency Cookbook
文件大小:5.48MB
文件格式:PDF
更新时间:2017-10-13 05:03:09
java concurrency thread 多线程 并发
When you work with a computer, you can do several things at once. You can hear music while you edit a document in a word processor and read your e-mail. This can be done because your operating system allows the concurrency of tasks. Concurrent programming is about the elements and mechanisms a platform offers to have multiple tasks or programs running at once and communicate with each other to exchange data or to synchronize with each other. Java is a concurrent platform and offers a lot of classes to execute concurrent tasks inside a Java program. With each version, Java increases the functionalities offered to programmers to facilitate the development of concurrent programs. This book covers the most important and useful mechanisms included in Version 7 of the Java concurrency API, so you will be able to use them directly in your applications, which are as follows: f f t e n . d u o l Basic thread management w.codec w w Thread synchronization mechanisms f f Thread creation and management delegation with executors f f Fork/Join framework to enhance the performance of your application f f Data structures for concurrent programs f f Adapting the default behavior of some concurrency classes to your needs f f Testing Java concurrency applications f f What this book covers Chapter 1, Thread Management will teach the readers how to make basic operations with threads. Creation, execution, and status management of the threads are explained through basic examples. Chapter 2, Basic Thread Synchronization will teach the readers to use the low-level Java mechanisms to synchronize a code. Locks and the synchronized keyword are explained in detail. Chapter 3, Thread Synchronization Utilities will teach the readers to use the high-level utilities of Java to manage the synchronization between the threads in Java. It includes an explanation of how to use the new Java 7 Phaser class to synchronize tasks divided into phases. Chapter 4, Thread Executors will teach the readers to delegate the thread management to executors. They allow running, managing, and getting the results of concurrent tasks. Chapter 5, Fork/Join Framework will teach the readers to use the new Java 7 Fork/Join framework. It’s a special kind of executor oriented to execute tasks that will be divided into smaller ones using the divide and conquer technique. Chapter 6, Concurrent Collections will teach the readers to how to use some concurrent data structures provided by the Java language. These data structures must be used in concurrent programs to avoid the use of synchronized blocks of code in their implementation. Chapter 7, Customizing Concurrency Classes will teach the readers how to adapt some of the most useful classes of the Java concurrency API to their needs. Chapter 8, Testing Concurrent Applications will teach the readers how to obtain information about the status of some of the most useful structures of the Java 7 concurrency API. The readers will also learn how to use some free tools to debug concurrent applications, such as the Eclipse, NetBeans IDE, or FindBugs applications to detect possible bugs on their applications.