users@grizzly.java.net

GrizzlyJmxManager

From: Jon Brisbin <jon_at_jbrisbin.com>
Date: Fri, 01 Jul 2011 09:32:45 -0500 (CDT)

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?

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