[collectd] JVM statistics collection?

Justo Alonso justo.alonso at gmail.com
Tue Feb 3 10:28:07 CET 2009


Hi Florian !

On Fri, Jan 30, 2009 at 2:07 PM, Florian Forster <octo at verplant.org> wrote:
> Hi Justo,
>
> sorry that it takes three months for me to take a look at your code :(
>

don't worry, lately, I'm very busy too

> On Wed, Oct 15, 2008 at 01:31:26PM +0200, Justo Alonso wrote:
>> at the end ... I have a operational jmx plugin to collect jvm
>> statistics. Please, someone can check it ??
>
> I'm currently in the process of merging your changes to the master
> branch, and I have some questions and comments ;)
>
>  - First off, your code looks very clean and readable and the documenta-
>   tion is comprehensive, thanks :)

ok, I have tried to follow your developments guides .. ;-)
>

>  - The .java files in contrib/java/ don't have a license / copyright
>   header. Could you add that or tell me under which license you're
>   providing that code? Sebastian and I usually use GPLv2 for our code,
>   but any GPL compatible license will do..

Yes, GPLv2 is ok ...
>
>  - Speaking of contrib/: I'll most likely put the .java files under
>   bindings/java/ and integrate them in the global build system. Or are
>   there any issues I'm not aware of?
>
>  - In the .java files you're using one Java 1.6 specific methods in two
>   places:
>
>     octo at huhu:~/collectd/contrib/java $ javac -Xlint:unchecked org/collectd/jmx/*.java
>     org/collectd/jmx/JMXCollectdMemoryData.java:60: cannot find symbol
>     symbol  : method asList()
>     location: class javax.management.AttributeList
>           for (Attribute at : al.asList()) {
>                                 ^
>   I tried to use the .iterator() method instead, but failed because I
>   don't know Java very well, the generics syntax is somehow weird and
>   Java even warns when I put an explicit cast there:
>
>     octo at huhu:~/collectd/contrib/java $ javac -Xlint:unchecked org/collectd/jmx/*.java
>     org/collectd/jmx/JMXCollectdThreadsData.java:60: warning: [unchecked] unchecked cast
>     found   : java.util.Iterator
>     required: java.util.Iterator<javax.management.Attribute>
>           Iterator<Attribute> iter = (Iterator<Attribute>) al.iterator ();
>                                                                        ^
>   Do you know how to fix this? I'm lost ;)

Java is not my favorite programming language, but I think that this work:
------------------
      AttributeList al = mbsc.getAttributes(this.getName (),
this.getAttributes ());
      ListIterator itr = al.listIterator();

      // for (Attribute at : al.listIterator()) {
      while( itr.hasNext()) {
        Attribute at = (Attribute)itr.next();
        CompositeData cd = (CompositeData) at.getValue();
-----------------

P.D: I will reply you to the other email (about java plugin, not jmx plugin)

j
>
> Regards,
> -octo
> --
> Florian octo Forster
> Hacker in training
> GnuPG: 0x91523C3D
> http://verplant.org/
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFJgvuYHdggu3Q05IYRAnHtAJ0Wl0pTBdJvIlEp7hs8COuIMbe17QCfSvOi
> dMpiQo2blDjyvRkj4NALOxk=
> =udAW
> -----END PGP SIGNATURE-----
>
>



More information about the collectd mailing list