jmx examle

 

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee"

xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"

default-lazy-init="false">

 

 

<context:annotation-config />

<context:component-scan base-package="org.baton.mx" />

<context:mbean-export default-domain="baton.mbeans" />

 

<bean id="d" class="org.baton.mx.DBean" />

 

<bean id="registry" class="org.springframework.remoting.rmi.RmiRegistryFactoryBean">

<property name="port" value="1099" />

</bean>

<bean id="serverConnector"

class="org.springframework.jmx.support.ConnectorServerFactoryBean"

depends-on="registry">

<property name="objectName" value="connector:name=rmi" />

<property name="serviceUrl"

value="service:jmx:rmi://localhost/jndi/rmi://localhost:1099/jmxconnector" />

<property name="threaded" value="true" />

<property name="daemon" value="true" />

</bean>

</beans>

 

 

 

 

@ManagedResource(objectName = "QueryExecutor:name=quec")

public class DBean {

 

 

@ManagedOperation

public void test() {

}

 

@ManagedOperation

public void disable() {

System.out.println("disabled");

}

你可能感兴趣的:(jmx)