jmx support

This commit is contained in:
温少
2012-03-20 04:36:47 +08:00
parent 533899e367
commit 67d4cfd4c4
6 changed files with 179 additions and 3 deletions
@@ -2,6 +2,7 @@ package com.alibaba.druid.bvt.pool;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
import java.util.concurrent.atomic.AtomicLong;
@@ -35,6 +36,12 @@ public class SpringFilterTest extends TestCase {
DataSource dataSource = (DataSource) context.getBean("dataSource");
Connection conn = dataSource.getConnection();
Statement stmt = conn.createStatement();
stmt.execute("select 1");
stmt.execute("select 2");
stmt.execute("select 1");
stmt.close();
conn.close();
TestFilter filter = (TestFilter) context.getBean("test-filter");
@@ -0,0 +1,30 @@
/*
* Copyright 2011 Alibaba.com All right reserved. This software is the
* confidential and proprietary information of Alibaba.com ("Confidential
* Information"). You shall not disclose such Confidential Information and shall
* use it only in accordance with the terms of the license agreement you entered
* into with Alibaba.com.
*/
package com.alibaba.druid.spring;
import java.lang.management.ManagementFactory;
import javax.management.MBeanServer;
import org.springframework.beans.factory.FactoryBean;
public class MBeanServerFactoryBean implements FactoryBean {
public MBeanServer getObject() throws Exception {
return ManagementFactory.getPlatformMBeanServer();
}
public Class<?> getObjectType() {
return ManagementFactory.getPlatformMBeanServer().getClass();
}
public boolean isSingleton() {
return true;
}
}