JTop on the NetBeans Platform

Charlie Hunt, one of Sun's performance gurus, is in town (where "town" equals "Prague, Czech Republic") and we've been studying the JDK's JTop plugin for JConsole, with a view to porting it to a NetBeans module. Let me tell you, it was not easy to figure out, at least initially. JTop consists of a class that extends JConsolePlugin, which integrates with JConsole, as well as a JPanel, which provided the actual user interface. We ended up dumping the JConsolePlugin class completely. There was nothing we needed from it.

Then we moved most of the content from the sample's other class, i.e, the JPanel, into a TopComponent, which integrates with the NetBeans Platform. We initially simply wanted to call the JPanel from the TopComponent and then add it to the TopComponent. I think that probably failed because the JPanel might have been getting instantiated (at least) twice. So we moved everything into the TopComponent, ran the NetBeans Platform, and there it was:

We also installed it into the Visual VM:

...and into NetBeans IDE:

In the latter case, we encountered a lot of problems because, as we eventually discovered, the Visual Web Pack has a security manager that conflicts with the security manager set in the tools.jar, which is where the JConsole API is located. We tried in vain to set security policies in various places before we discovered the culprit and then simply excluded the Visual Web Pack from the IDE. Then the JTop plugin worked without a problem.

And, because the original JTop plugin uses the cool new JDK6 SwingWorker class, the TopComponent is updated automatically in the background and the thread information is continuously current. Hurray!


Cool! Where can I get a copy of that .nbm? :-)

Posted by Gregg Sporar on January 30, 2008 at 11:36 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« April 2014