gcj & JMX

Andrew John Hughes gnu_andrew@member.fsf.org
Tue Feb 13 23:51:00 GMT 2007


On Tue, 2007-02-13 at 14:32 +0100, Patrick Olinet wrote:
> Hi Andrew,
> 
> Thanks for your first reply.
> 
> My gcj version is the one coming with the ubuntu 6.10 distro. It seems
> to be a pre-4.1.2 release (built 20060928).
> 

I reckon this will be based on Classpath 0.92.  To find out for
definite, you can obtain the gnu.classpath.version property from your
system properties (System.getProperties().get("gnu.classpath.version")
or something like that).  This will have all the interfaces for
java.lang.management, but will be missing the link to the management
server (check for ManagementFactory.getPlatformMBeanServer() if you want
to know for definite).

> You're right. If I look into my libgcj.jar file, I can also see
> classes in the javax.management packages, but not as many as what is
> in the mx4j.jar file. Does that mean the port is not complete (at
> least not for my gcj version) and I should still go with mx4j instead
> of using the embedded javax.management classes ?
> 

JMX is not yet complete in GNU Classpath.  javax.management will be at a
much earlier stage back then (at present, msot of javax.management and
all of javax.management.openmbean for 1.5 is there.  Remote
accessibility, model mbeans and some other stuff is still missing).  You
should be able to use mx4j with libgcj and this will give you a full
implementation until libgcj's is ready.  

> Actually, I don't know much about JMX ;-) My point is just to find out
> an easy way to monitor the memory usage of my application running with
> gcj, which is, by the way, a great project! From what I could have
> seen with Sun's implementations, JMX looks to me like a good and easy
> way to do that, but I guess I need to learn more about it to use it
> from gcj.
> 

Yeah, I wasn't sure in my first mail, so I was suggesting just about
everything.  The best thing to try for the time being is to use the
ManagementFactory class to obtain instances of the beans (see the API
docs for this -- MemoryMXBean is probably the one you want), and see
what information you can obtain.  At some point, it should work with
jconsole.  It may indeed even work with current Classpath and mx4j (to
provide remote accessibility); I haven't tried.

> Patrick
> 
> 
> On 2/13/07, Andrew John Hughes <a.hughes@dcs.shef.ac.uk> wrote:
> >
> > On 13 Feb 2007, at 07:42, Patrick Olinet wrote:
> >
> > > Hi folks,
> > >
> > > I'd like to know if there is a gcj equivalent to the Sun's monitoring
> > > & management JMX extension. The java.lang.management.* classes seem to
> > > exist in my libgcj.jar file, but I have no idea of their status and
> > > whether they can be used by the mx4j package that provides the JMX
> > > support on my system. If they can, how are they supposed to work ?
> > >
> > > My point is to be able to monitor the memory usage of my application,
> > > as it's possible to do with Sun's jconsole tool when you set the
> > > 'com.sun.management.jmx.remote' system property at application
> > > startup.
> > >
> > > Any thoughts ?
> > >
> > > Thanks in advance for your replies.
> > >
> > > Patrick
> >
> > Hi Patrick,
> >
> > I've been working on the JMX classes (which are now part of 1.5 and
> > 1.6) since about last June.
> > This initially involved the java.lang.management classes (and their
> > implementation, to an extent,
> > for gcj) and has now moved on to include the javax.management stuff
> > (which mx4j also provides).
> >
> > The status of your copy of libgcj depends on a variety of factors,
> > including which version of gcc
> > you're using, with which distribution and how recently that was
> > synchronised with the main Classpath
> > repository.  There should be others on this list more suitable to
> > comment on the specifics here.
> >
> > The current status is that the interfaces for java.lang.management
> > are fully implemented to 1.6.
> > These are implemented to varying degrees in the various packages that
> > use Classpath as an
> > upstream (gcj included).  I'd need to go back to my code for gcj to
> > ascertain what stage the implementation
> > is for this, but memory usage monitoring shouldn't be too difficult
> > to add if it's not already present.
> >
> > As to remote monitoring, this relies more on the JMX implementation.
> > Assuming mx4j has the remote
> > stuff implemented, it should be possible to monitor the
> > lang.management beans using it (the beans themselves
> > are just ordinary JMX beans), but there may be some bits and bobs
> > missing to make this like Sun's implementation.
> > Certainly, recent versions of the code provide the beans registered
> > in the platform bean server, accessible
> > via ManagementFactory.getPlatformMBeanServer().
> >
> > Hope this helps,
> > Let me know if there's anything more I can tell you about this,
> >
> > Cheers,
> > --
> > Andrew :)
> >

Have fun,
-- 
Andrew :-)

Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html
public class gcj extends Freedom implements Java { ... }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://gcc.gnu.org/pipermail/java/attachments/20070213/322242ea/attachment.sig>


More information about the Java mailing list