To enable JMX, you just need to implement the Management interface, and set it using the enableJMX method of the GrizzlyWebServer class. As you can see, you can plug your own JMX implementation easily using the Management interface. In the example above, I’ve just used the Apache Commons Modeler, which does all the JMX “bla bla bla” for me via its org.apache.commons.modeler.Registry static class.

Miaaaaaam! Next time I will explain how to grab statistics from your embedded GrizzlyWebServer, like number of requests, time spend, thread pool stats, etc. You can download the example above here. The binary can be used as it is and include all the Grizzly required classes to run.