List of usage examples for org.springframework.jmx.support JmxUtils getMethodSignature
public static String[] getMethodSignature(Method method)
From source file:org.apache.camel.component.zookeeper.ZooKeeperEndpointTest.java
public synchronized void testEnpointConfigurationCanBeSetViaJMX() throws Exception { Set s = mbsc.queryNames(new ObjectName(domainName + ":type=endpoints,*"), null); assertEquals("Could not find endpoints: " + s, 2, s.size()); ObjectName zepName = new ArrayList<ObjectName>(s).get(0); verifyManagedAttribute(zepName, "Path", "/someotherpath"); verifyManagedAttribute(zepName, "Create", true); verifyManagedAttribute(zepName, "Repeat", true); verifyManagedAttribute(zepName, "ListChildren", true); verifyManagedAttribute(zepName, "AwaitExistence", true); verifyManagedAttribute(zepName, "Timeout", 12345); verifyManagedAttribute(zepName, "Backoff", 12345L); mbsc.invoke(zepName, "clearServers", null, JmxUtils.getMethodSignature(ZooKeeperEndpoint.class.getMethod("clearServers", null))); mbsc.invoke(zepName, "addServer", new Object[] { "someserver:12345" }, JmxUtils .getMethodSignature(ZooKeeperEndpoint.class.getMethod("addServer", new Class[] { String.class }))); }
From source file:org.springframework.jmx.access.MBeanClientInterceptor.java
/** * Routes a method invocation (not a property get/set) to the corresponding * operation on the managed resource./*ww w . j a v a2s .co m*/ * @param method the method corresponding to operation on the managed resource. * @param args the invocation arguments * @return the value returned by the method invocation. */ private Object invokeOperation(Method method, Object[] args) throws JMException, IOException { Assert.state(this.serverToUse != null, "No MBeanServerConnection available"); MethodCacheKey key = new MethodCacheKey(method.getName(), method.getParameterTypes()); MBeanOperationInfo info = this.allowedOperations.get(key); if (info == null) { throw new InvalidInvocationException( "Operation '" + method.getName() + "' is not exposed on the management interface"); } String[] signature; synchronized (this.signatureCache) { signature = this.signatureCache.get(method); if (signature == null) { signature = JmxUtils.getMethodSignature(method); this.signatureCache.put(method, signature); } } return this.serverToUse.invoke(this.objectName, method.getName(), args, signature); }