mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
format code
This commit is contained in:
@@ -60,7 +60,7 @@ public class DruidDataSourceStatManager implements DruidDataSourceStatManagerMBe
|
||||
MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
|
||||
if (dataSources.size() == 0) {
|
||||
try {
|
||||
|
||||
|
||||
ObjectName objectName = new ObjectName(MBEAN_NAME);
|
||||
if (!mbeanServer.isRegistered(objectName)) {
|
||||
mbeanServer.registerMBean(instance, objectName);
|
||||
@@ -98,9 +98,9 @@ public class DruidDataSourceStatManager implements DruidDataSourceStatManagerMBe
|
||||
|
||||
public synchronized static void remove(DruidDataSource dataSource) {
|
||||
ObjectName objectName = dataSources.remove(dataSource);
|
||||
|
||||
|
||||
if (objectName == null) {
|
||||
objectName = dataSource.getObjectName();
|
||||
objectName = dataSource.getObjectName();
|
||||
}
|
||||
|
||||
if (objectName == null) {
|
||||
@@ -164,54 +164,63 @@ public class DruidDataSourceStatManager implements DruidDataSourceStatManagerMBe
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
// 0 - 4
|
||||
map.put("Name", dataSource.getName());
|
||||
map.put("URL", dataSource.getUrl());
|
||||
map.put("CreateCount", dataSource.getCreateCount());
|
||||
map.put("DestroyCount", dataSource.getDestroyCount());
|
||||
map.put("ConnectCount", dataSource.getConnectCount());
|
||||
|
||||
// 5 - 9
|
||||
map.put("CloseCount", dataSource.getCloseCount());
|
||||
map.put("ActiveCount", dataSource.getActivePeak());
|
||||
map.put("PoolingCount", dataSource.getPoolingCount());
|
||||
map.put("LockQueueLength", dataSource.getLockQueueLength());
|
||||
map.put("WaitThreadCount", dataSource.getNotEmptyWaitThreadPeak());
|
||||
|
||||
// 10 - 14
|
||||
map.put("InitialSize", dataSource.getInitialSize());
|
||||
map.put("MaxActive", dataSource.getMaxActive());
|
||||
map.put("MinIdle", dataSource.getMinIdle());
|
||||
map.put("PoolPreparedStatements", dataSource.isPoolPreparedStatements());
|
||||
map.put("TestOnBorrow", dataSource.isTestOnBorrow());
|
||||
|
||||
// 15 - 19
|
||||
map.put("TestOnReturn", dataSource.isTestOnReturn());
|
||||
map.put("MinEvictableIdleTimeMillis", dataSource.getMinEvictableIdleTimeMillis());
|
||||
map.put("ConnectErrorCount", dataSource.getConnectErrorCount());
|
||||
map.put("CreateTimespanMillis", dataSource.getCreateTimespanMillis());
|
||||
map.put("DbType", dataSource.getDbType());
|
||||
|
||||
// 20 - 24
|
||||
map.put("ValidationQuery", dataSource.getValidationQuery());
|
||||
map.put("ValidationQueryTimeout", dataSource.getValidationQueryTimeout());
|
||||
map.put("DriverClassName", dataSource.getDriverClassName());
|
||||
map.put("Username", dataSource.getUsername());
|
||||
map.put("RemoveAbandonedCount", dataSource.getRemoveAbandonedCount());
|
||||
|
||||
// 25 - 29
|
||||
map.put("NotEmptyWaitCount", dataSource.getNotEmptyWaitCount());
|
||||
map.put("NotEmptyWaitNanos", dataSource.getNotEmptyWaitNanos());
|
||||
map.put("ErrorCount", dataSource.getErrorCount());
|
||||
map.put("ReusePreparedStatementCount", dataSource.getCachedPreparedStatementHitCount());
|
||||
map.put("StartTransactionCount", dataSource.getStartTransactionCount());
|
||||
|
||||
// 30 - 34
|
||||
map.put("CommitCount", dataSource.getCommitCount());
|
||||
map.put("RollbackCount", dataSource.getRollbackCount());
|
||||
map.put("LastError", JMXUtils.getErrorCompositeData(dataSource.getLastError()));
|
||||
map.put("LastCreateError", JMXUtils.getErrorCompositeData(dataSource.getLastCreateError()));
|
||||
map.put("PreparedStatementCacheDeleteCount", dataSource.getCachedPreparedStatementDeleteCount());
|
||||
|
||||
|
||||
// 35 - 39
|
||||
map.put("PreparedStatementCacheAccessCount", dataSource.getCachedPreparedStatementAccessCount());
|
||||
map.put("PreparedStatementCacheMissCount", dataSource.getCachedPreparedStatementMissCount());
|
||||
map.put("PreparedStatementCacheHitCount", dataSource.getCachedPreparedStatementHitCount());
|
||||
map.put("PreparedStatementCacheCurrentCount", dataSource.getCachedPreparedStatementCount());
|
||||
map.put("Version", dataSource.getVersion());
|
||||
|
||||
// 40 -
|
||||
map.put("LastErrorTime", dataSource.getLastErrorTime());
|
||||
map.put("LastCreateErrorTime", dataSource.getLastCreateErrorTime());
|
||||
map.put("CreateErrorCount", dataSource.getCreateErrorCount());
|
||||
@@ -228,36 +237,130 @@ public class DruidDataSourceStatManager implements DruidDataSourceStatManagerMBe
|
||||
}
|
||||
|
||||
OpenType<?>[] indexTypes = new OpenType<?>[] {
|
||||
//
|
||||
SimpleType.STRING, SimpleType.STRING, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, //
|
||||
SimpleType.LONG, SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.INTEGER, //
|
||||
SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.INTEGER, SimpleType.BOOLEAN, SimpleType.BOOLEAN, //
|
||||
SimpleType.BOOLEAN, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.STRING, //
|
||||
SimpleType.STRING, SimpleType.INTEGER, SimpleType.STRING, SimpleType.STRING, SimpleType.LONG, //
|
||||
SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG//
|
||||
, SimpleType.LONG, SimpleType.LONG, JMXUtils.getThrowableCompositeType(), JMXUtils.getThrowableCompositeType(), SimpleType.LONG //
|
||||
, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.STRING //
|
||||
, SimpleType.DATE , SimpleType.DATE, SimpleType.LONG
|
||||
// 0 - 4
|
||||
SimpleType.STRING, //
|
||||
SimpleType.STRING, //
|
||||
SimpleType.LONG, //
|
||||
SimpleType.LONG, //
|
||||
SimpleType.LONG, //
|
||||
|
||||
// 5 - 9
|
||||
SimpleType.LONG, //
|
||||
SimpleType.INTEGER, //
|
||||
SimpleType.INTEGER, //
|
||||
SimpleType.INTEGER, //
|
||||
SimpleType.INTEGER, //
|
||||
|
||||
// 10 - 14
|
||||
SimpleType.INTEGER, //
|
||||
SimpleType.INTEGER, //
|
||||
SimpleType.INTEGER, //
|
||||
SimpleType.BOOLEAN, //
|
||||
SimpleType.BOOLEAN, //
|
||||
|
||||
// 15 - 19
|
||||
SimpleType.BOOLEAN, //
|
||||
SimpleType.LONG, //
|
||||
SimpleType.LONG, //
|
||||
SimpleType.LONG, //
|
||||
SimpleType.STRING, //
|
||||
|
||||
// 20 - 24
|
||||
SimpleType.STRING, //
|
||||
SimpleType.INTEGER, //
|
||||
SimpleType.STRING, //
|
||||
SimpleType.STRING, //
|
||||
SimpleType.LONG, //
|
||||
|
||||
// 25 - 29
|
||||
SimpleType.LONG, //
|
||||
SimpleType.LONG, //
|
||||
SimpleType.LONG, //
|
||||
SimpleType.LONG, //
|
||||
SimpleType.LONG, //
|
||||
|
||||
// 30 - 34
|
||||
SimpleType.LONG, //
|
||||
SimpleType.LONG, //
|
||||
JMXUtils.getThrowableCompositeType(), //
|
||||
JMXUtils.getThrowableCompositeType(), //
|
||||
SimpleType.LONG, //
|
||||
|
||||
// 35 - 39
|
||||
SimpleType.LONG, //
|
||||
SimpleType.LONG, //
|
||||
SimpleType.LONG, //
|
||||
SimpleType.LONG, //
|
||||
SimpleType.STRING, //
|
||||
|
||||
// 40 -
|
||||
SimpleType.DATE, //
|
||||
SimpleType.DATE, //
|
||||
SimpleType.LONG //
|
||||
//
|
||||
};
|
||||
|
||||
String[] indexNames = {
|
||||
//
|
||||
"Name", "URL", "CreateCount", "DestroyCount",
|
||||
// 0 - 4
|
||||
"Name", //
|
||||
"URL", //
|
||||
"CreateCount", //
|
||||
"DestroyCount", //
|
||||
"ConnectCount", //
|
||||
"CloseCount", "ActiveCount", "PoolingCount", "LockQueueLength",
|
||||
|
||||
// 5 - 9
|
||||
"CloseCount", //
|
||||
"ActiveCount", //
|
||||
"PoolingCount", //
|
||||
"LockQueueLength", //
|
||||
"WaitThreadCount", //
|
||||
"InitialSize", "MaxActive", "MinIdle", "PoolPreparedStatements",
|
||||
|
||||
// 10 - 14
|
||||
"InitialSize", //
|
||||
"MaxActive", //
|
||||
"MinIdle", //
|
||||
"PoolPreparedStatements", //
|
||||
"TestOnBorrow", //
|
||||
"TestOnReturn", "MinEvictableIdleTimeMillis", "ConnectErrorCount", "CreateTimespanMillis",
|
||||
|
||||
// 15 - 19
|
||||
"TestOnReturn", //
|
||||
"MinEvictableIdleTimeMillis", //
|
||||
"ConnectErrorCount", //
|
||||
"CreateTimespanMillis", //
|
||||
"DbType", //
|
||||
"ValidationQuery", "ValidationQueryTimeout", "DriverClassName", "Username",
|
||||
|
||||
// 20 - 24
|
||||
"ValidationQuery", //
|
||||
"ValidationQueryTimeout", //
|
||||
"DriverClassName", //
|
||||
"Username", //
|
||||
"RemoveAbandonedCount", //
|
||||
"NotEmptyWaitCount", "NotEmptyWaitNanos", "ErrorCount", "ReusePreparedStatementCount",
|
||||
|
||||
// 25 - 29
|
||||
"NotEmptyWaitCount", //
|
||||
"NotEmptyWaitNanos", //
|
||||
"ErrorCount", //
|
||||
"ReusePreparedStatementCount", //
|
||||
"StartTransactionCount", //
|
||||
"CommitCount", "RollbackCount", "LastError", "LastCreateError", "PreparedStatementCacheDeleteCount" //
|
||||
, "PreparedStatementCacheAccessCount", "PreparedStatementCacheMissCount", "PreparedStatementCacheHitCount", "PreparedStatementCacheCurrentCount", "Version" //
|
||||
, "LastErrorTime", "LastCreateErrorTime", "CreateErrorCount"
|
||||
|
||||
// 30 - 34
|
||||
"CommitCount", //
|
||||
"RollbackCount", //
|
||||
"LastError", //
|
||||
"LastCreateError", //
|
||||
"PreparedStatementCacheDeleteCount", //
|
||||
|
||||
// 35 - 39
|
||||
"PreparedStatementCacheAccessCount", //
|
||||
"PreparedStatementCacheMissCount", //
|
||||
"PreparedStatementCacheHitCount", //
|
||||
"PreparedStatementCacheCurrentCount", //
|
||||
"Version" //
|
||||
|
||||
// 40 -
|
||||
, "LastErrorTime", //
|
||||
"LastCreateErrorTime", //
|
||||
"CreateErrorCount" //
|
||||
//
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user