Wednesday 16 April 2014

AdminControl invoke with multiple arguments


Basic syntax:
AdminControl.invoke( <MBean string>, '<method>', '<arg1>  <arg2>' )

So it seems that AdminControl.invoke needs the third argument to be a string (I've often seen the error message "Third argument cannot be coerced into a string")

Here's an example of running getCacheStatistics on a DynaCache mbean:
AdminControl.invoke(
    myBean, 
    'getCacheStatistics',
    '/services/cache/appdata CacheHits'
)

The third argument in the command above is providing the cache instance name (/services/cache/appdata) followed by a space and then the name of the metric we're after (CacheHits)

In the case of <DynaCache MBean>.getCacheStatistics you can provide multiple metrics to retrieve by providing an array as follows:
AdminControl.invoke(
    myBean,
    'getCacheStatistics',
    '/services/cache/appdata [CacheHits DiskCacheSizeInMB]'
)

Taken from the following article...

No comments:

Post a Comment