users@grizzly.java.net

Re: GrizzlyJmxManager

From: Jon Brisbin <jon_at_jbrisbin.com>
Date: Fri, 1 Jul 2011 13:39:04 -0500

My motto: when all else fails, read the docs. ;)

Thanks!

jb

On Jul 1, 2011, at 10:13 AM, Ryan Lubke wrote:

> On 7/1/11 7:32 AM, Jon Brisbin wrote:
>>
>> I'm trying to set up some quick and dirty JMX monitoring on a proof-of-concept app I'm working. I dug through the code trying to find examples of using this but wasn't very successful.
>>
>> How do I register the various components with JMX so that I can see them from jconsole?
>
> Have you reviewed the monitoring documentation [1]?
> It includes examples.
>
>
> [1] http://grizzly.java.net/nonav/docs/docbkx2.0/html/monitoring-jmx.html
>
>
>>
>> I've got a demo in two hours and I'd like to show this. If not, no big deal, but having a visual would be good that "you can monitor Grizzly easily using jconsole" so they don't just have to take my theoretical word for it. ;)
>>
>> I'm using Spock for my BDD, so the setup looks like this:
>>
>> def setup() {
>> builder.add(new TransportFilter())
>> builder.add(httpServerFilter)
>> builder.add(new CustomServerFilter())
>>
>> transport.setProcessor(builder.build())
>> transport.bind(8080)
>> transport.start()
>>
>> jmxManager = GrizzlyJmxManager.instance();
>>
>> heapJmx = new org.glassfish.grizzly.memory.jmx.HeapMemoryManager(heap)
>> jmxManager.registerAtRoot(heapJmx, "com.sun.grizzly:type=${heapJmx.jmxName}")
>>
>> httpJmx = new org.glassfish.grizzly.http.jmx.HttpCodecFilter(serverFilter)
>> jmxManager.registerAtRoot(httpJmx, "com.sun.grizzly:type=${httpJmx.jmxName}")
>>
>> nioJmx = new org.glassfish.grizzly.nio.transport.jmx.TCPNIOTransport(transport)
>> jmxManager.registerAtRoot(nioJmx, "com.sun.grizzly:type=${nioJmx.jmxName}")
>> }
>>
>>
>>
>> Thanks!
>>
>> Jon Brisbin
>> http//jbrisbin.com
>>
>>
>


Thanks!

Jon Brisbin

http://jbrisbin.com
Twitter: @j_brisbin