Book Image

OpenJDK Cookbook

Book Image

OpenJDK Cookbook

Overview of this book

Table of Contents (20 chapters)
OpenJDK Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a plugin for VisualVM


VisualVM is just an application which has a predefined and limited set of features. It is a framework, which means that it is possible to extend it. The way in which VisualVM provides for extension is via the plugin API which allows us to create new plugins which are then available through the application. Such plugins can do various things, but are mostly used to provide new ways of monitoring or controlling the JVM applications.

Getting ready

The current (at the time of writing) trunk version of VisualVM requires the NetBeans platform and IDE v.8. So we need to ensure that the current version of the platform is available on the machine. If there is any doubt, check the page with VisualVM trunk build instructions at http://visualvm.java.net/build/build.html.

How to do it...

Let's start with what we are going to monitor. It seems like the simplest thing we can do is to build a component which will tick the data that we can read. For example, look at the following...