<?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:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                     http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd"
       default-autowire="byName">

	<!-- mbeanServer用于注册mbean -->
    <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
        <property name="locateExistingServerIfPossible" value="true"/>
    </bean>
	
	<!-- 异常统计 -->
    <bean id="errorLoggerWatcher" class="com.sohu.cache.jmx.ErrorLoggerWatcher" init-method="init"/>
          
    <!-- cachecloud数据监控 -->
    <bean id="cachecloudDataWatcher" class="com.sohu.tv.cache.client.common.jmx.CachecloudDataWatcher"/>
    
    <!-- 客户端上报jmx -->
    <bean id="clientReportAsyncThreadPoolStatistics" class="com.sohu.cache.jmx.ThreadPoolStatisticsImpl">
        <constructor-arg index="0">
            <util:constant static-field="com.sohu.cache.async.AsyncThreadPoolFactory.CLIENT_REPORT_THREAD_POOL"/>
        </constructor-arg>
    </bean>
    
    <!-- 实例慢查询jmx -->
    <bean id="redisSlowlogAsyncThreadPoolStatistics" class="com.sohu.cache.jmx.ThreadPoolStatisticsImpl">
        <constructor-arg index="0">
            <util:constant static-field="com.sohu.cache.async.AsyncThreadPoolFactory.REDIS_SLOWLOG_THREAD_POOL"/>
        </constructor-arg>
    </bean>

	<!-- mbeanServerExporter -->
    <bean id="mbeanServerExporter" class="org.springframework.jmx.export.MBeanExporter">
        <property name="beans">
            <map>
                <entry key="cacheCloudJMX:myjavaobj=errorLoggerWatcher" value-ref="errorLoggerWatcher"/>
                <entry key="cacheCloudJMX:myjavaobj=cachecloudDataWatcher" value-ref="cachecloudDataWatcher"/>
                <entry key="cacheCloudJMX:myjavaobj=clientReportAsyncThreadPoolStatistics" value-ref="clientReportAsyncThreadPoolStatistics"/>
                <entry key="cacheCloudJMX:myjavaobj=redisSlowlogAsyncThreadPoolStatistics" value-ref="redisSlowlogAsyncThreadPoolStatistics"/>
            </map>
        </property>
        <property name="server" ref="mbeanServer"/>
        <property name="assembler" ref="assembler"/>
    </bean>

	<!-- 接口集合 -->
    <bean id="assembler" class="org.springframework.jmx.export.assembler.InterfaceBasedMBeanInfoAssembler">
        <property name="managedInterfaces">
            <list>
                <value>com.sohu.cache.jmx.ErrorLoggerWatcherMBean</value>
                <value>com.sohu.tv.cache.client.common.jmx.CachecloudDataWatcherMBean</value>
                <value>com.sohu.cache.jmx.ThreadPoolStatisticsMBean</value>
            </list>
        </property>
    </bean>

</beans>