Sign in to edit and +1 items.
Login required
Download

JMX Plugin

(4)
Author(s) kensipe
Current Release 0.7   (1 year ago)
Grails Version 1.1.1 > *
Tags performance  utility 
Dependency
compile ":jmx:0.7"
Last updated by calef 1 year ago
grails install-plugin jmx
Last updated by burtbeckwith 1 year ago

JMX Plugin

This plugin adds JMX MBeanServer support through Spring and configures a number MBeans.

Plugin features:

  • Configures MBeanServer in Grails Application
  • Registers services which are singletons and annotated with: static expose = ['jmx'] with JMX
  • Provides default object naming {appname}:service=${serviceName},type=service
  • Allows for object name override: static expose = ['jmx:service=Country,type=special']
  • Allows for exclusion map: static jmxexpose = ['excludeMethods':'isTransactional,setTransactional,getTransactional,getJmxexpose,setJmxexpose,getExpose,setExpose']
  • Checks to see if Hibernate is a plugin and if so it exposes the Hibernate Statistics
  • Exposes Log4j for runtime logging level configuration
  • Exposes the Grails DataSource
  • Allows for any spring bean to be exposed through Config.groovy

Setup

grails install-plugin jmx

There is nothing to do after the install if you have no services to expose. Just run the application and use jconsole to administer.

However to be able to connect to the exposed services (which also includes the ones made available by the plugin by default) you have to set the system property com.sun.management.jmxremote before running your app.

Exposing Services

By default, the plugin only supports exposing Services. This is accomplished by add 'jmx' to the static expose property as outlined below:

class StateService {

static transactional = true static expose = ['jmx'] … }

This will expose the service leverage a convention for the service name. Alternatively you can be very explicit on the object through the following example:
class CountryService {

static transactional = true static expose = ['jmx:service=Country,type=special'] … }

Exposing Spring Beans

The plugin also supports exposing other Spring Beans - e.g. registered via resources.groovy . This is accomplished by adding 'jmx' to the static expose property as outlined above and using the following code in Config.groovy -

grails {
   jmx {
      exportBeans = ['myBean']
   }
}

Future plans

  • Check for proper ObjectName
  • Expose Jetty Services

Release Notes

v.0.3: First released into the wild.

Questions

Contact kensipe@gmail.com
Last updated by admin 3 years ago
Last updated by admin 3 years ago