Book Image

Mastering Concurrency Programming with Java 9 - Second Edition

By : Javier Fernández González
Book Image

Mastering Concurrency Programming with Java 9 - Second Edition

By: Javier Fernández González

Overview of this book

Concurrency programming allows several large tasks to be divided into smaller sub-tasks, which are further processed as individual tasks that run in parallel. Java 9 includes a comprehensive API with lots of ready-to-use components for easily implementing powerful concurrency applications, but with high flexibility so you can adapt these components to your needs. The book starts with a full description of the design principles of concurrent applications and explains how to parallelize a sequential algorithm. You will then be introduced to Threads and Runnables, which are an integral part of Java 9's concurrency API. You will see how to use all the components of the Java concurrency API, from the basics to the most advanced techniques, and will implement them in powerful real-world concurrency applications. The book ends with a detailed description of the tools and techniques you can use to test a concurrent Java application, along with a brief insight into other concurrency mechanisms in JVM.
Table of Contents (21 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Dedication
Preface

Monitoring concurrency applications


When you implement Java applications, you normally use an IDE such as Eclipse or NetBeans to create your projects and write your source code. But the JDK (short for Java Development Kit) includes tools you can use to compile, execute, or generate Javadoc documents. One of those tools is JConsole, which is a graphical tool that shows you information about the applications that are executing in a JVM. You can find it in the bin directory of your JDK installation (jconsole.exe).

If you execute it, you will see a window similar to this:

You can monitor processes that are running in your own computer by selecting one of the processes that appear in the Local Process section, or a remote process introducing its data in the Remote Process section.

Once you have selected or introduced the data of the process you want to monitor, you click the Connect button. You may see a window alerting you that you are starting an insecure connection. That window will be similar...