geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trygve Hardersen" <trygve.harder...@gmail.com>
Subject Re: Monitoring Memory Usage
Date Wed, 13 Aug 2008 17:15:49 GMT
I'm not a Geronimo committer, but I believe the relevant code is in
org.apache.geronimo.console.jsr77.Jsr77Lookup:

    public DynamicServerInfo getJavaVMStatistics() {
        HttpSession session = WebContextFactory.get().getSession(true);
        ManagementHelper helper =
PortletManager.getManagementHelper(session);
        J2EEDomain[] domains = helper.getDomains();
        J2EEServer[] servers = domains[0].getServerInstances();
        JVM[] jvms = helper.getJavaVMs(servers[0]);
        long elapsed = System.currentTimeMillis() -
jvms[0].getKernelBootTime().getTime();
        if(jvms[0].isStatisticsProvider()) {
            JVMStats stats = (JVMStats)
((StatisticsProvider)jvms[0]).getStats();
            BoundedRangeStatistic heap = stats.getHeapSize();
            return new DynamicServerInfo(heap.getCurrent(),
heap.getHighWaterMark(), heap.getUpperBound(), elapsed);
        } else {
            return new DynamicServerInfo(elapsed);
        }
    }

Trygve

2008/8/13 Peter L. Berghold <peter@berghold.net>

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Peter L. Berghold wrote:
> > Trygve Hardersen wrote:
> >> Sorry, it's java.lang.Runtime, no import needed :)
> >
>
> That's all well and good (and fun to play with) but I'm hoping to get
> the same info that the console gives you pictorially.
>
> I'm going to this effort because one of the web applications I'm running
> under Geronimo/Tomcat has a habit running out of memory (memory leak?)
> and Geronimo will exit without any error codes, log messages or anything
> else that would let me know why...
>
> Besides, I like being proactive.
>
>
> - --
>
> Peter L. Berghold     http://www.berghold.net   peter@berghold.net
> Unix Professional     Dog Agility Fan   Crazed Cook
> "Those who fail to learn from history are condemned to repeat it."
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFIoxHsUM9/01RIhaARAk3DAKC5huQi4kKoQRpokBx1qqitkOhkwACeLfsh
> EzKtsQc2GPswwkMZ73WQfVw=
> =U3Y1
> -----END PGP SIGNATURE-----
>

Mime
View raw message