Search in sources :

Example 56 with CompositeType

use of javax.management.openmbean.CompositeType in project druid by alibaba.

the class DruidDataSourceStatManager method getCompositeData.

public CompositeDataSupport getCompositeData(Object dataSource) throws JMException {
    CompositeType rowType = getDruidDataSourceCompositeType();
    Map<String, Object> map = DruidDataSourceUtils.getStatDataForMBean(dataSource);
    return new CompositeDataSupport(rowType, map);
}
Also used : CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) CompositeType(javax.management.openmbean.CompositeType)

Example 57 with CompositeType

use of javax.management.openmbean.CompositeType in project druid by alibaba.

the class JdbcDataSourceStat method getConnectionList.

@Override
public TabularData getConnectionList() throws JMException {
    CompositeType rowType = JdbcConnectionStat.Entry.getCompositeType();
    String[] indexNames = rowType.keySet().toArray(new String[rowType.keySet().size()]);
    TabularType tabularType = new TabularType("ConnectionListStatistic", "ConnectionListStatistic", rowType, indexNames);
    TabularData data = new TabularDataSupport(tabularType);
    for (Map.Entry<Long, JdbcConnectionStat.Entry> entry : getConnections().entrySet()) {
        data.put(entry.getValue().getCompositeData());
    }
    return data;
}
Also used : TabularDataSupport(javax.management.openmbean.TabularDataSupport) TabularType(javax.management.openmbean.TabularType) AtomicLong(java.util.concurrent.atomic.AtomicLong) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ConcurrentMap(java.util.concurrent.ConcurrentMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) CompositeType(javax.management.openmbean.CompositeType) TabularData(javax.management.openmbean.TabularData)

Example 58 with CompositeType

use of javax.management.openmbean.CompositeType in project druid by alibaba.

the class JdbcDataSourceStat method getSqlList.

@Override
public TabularData getSqlList() throws JMException {
    Map<String, JdbcSqlStat> sqlStatMap = this.getSqlStatMap();
    CompositeType rowType = JdbcSqlStat.getCompositeType();
    String[] indexNames = rowType.keySet().toArray(new String[rowType.keySet().size()]);
    TabularType tabularType = new TabularType("SqlListStatistic", "SqlListStatistic", rowType, indexNames);
    TabularData data = new TabularDataSupport(tabularType);
    for (Map.Entry<String, JdbcSqlStat> entry : sqlStatMap.entrySet()) {
        data.put(entry.getValue().getCompositeData());
    }
    return data;
}
Also used : TabularDataSupport(javax.management.openmbean.TabularDataSupport) TabularType(javax.management.openmbean.TabularType) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ConcurrentMap(java.util.concurrent.ConcurrentMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) CompositeType(javax.management.openmbean.CompositeType) TabularData(javax.management.openmbean.TabularData)

Example 59 with CompositeType

use of javax.management.openmbean.CompositeType in project druid by alibaba.

the class JdbcSqlStat method getCompositeType.

public static CompositeType getCompositeType() throws JMException {
    if (COMPOSITE_TYPE != null) {
        return COMPOSITE_TYPE;
    }
    OpenType<?>[] indexTypes = new OpenType<?>[] { //
    SimpleType.LONG, //
    SimpleType.STRING, //
    SimpleType.STRING, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.DATE, //
    SimpleType.LONG, //
    JMXUtils.getThrowableCompositeType(), //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.DATE, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.STRING, //
    SimpleType.STRING, //
    SimpleType.STRING, //
    SimpleType.STRING, //
    SimpleType.STRING, //
    SimpleType.DATE, //
    SimpleType.STRING, //
    SimpleType.LONG, //
    SimpleType.STRING, //
    new ArrayType<Long>(SimpleType.LONG, true), //
    SimpleType.STRING, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    new ArrayType<Long>(SimpleType.LONG, true), //
    new ArrayType<Long>(SimpleType.LONG, true), //
    new ArrayType<Long>(SimpleType.LONG, true), //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG, //
    SimpleType.LONG };
    String[] indexNames = { //
    "ID", //
    "DataSource", //
    "SQL", //
    "ExecuteCount", //
    "ErrorCount", //
    "TotalTime", //
    "LastTime", //
    "MaxTimespan", //
    "LastError", //
    "EffectedRowCount", //
    "FetchRowCount", //
    "MaxTimespanOccurTime", //
    "BatchSizeMax", //
    "BatchSizeTotal", //
    "ConcurrentMax", //
    "RunningCount", //
    "Name", //
    "File", //
    "LastErrorMessage", //
    "LastErrorClass", //
    "LastErrorStackTrace", //
    "LastErrorTime", //
    "DbType", //
    "InTransactionCount", //
    "URL", //
    "Histogram", //
    "LastSlowParameters", //
    "ResultSetHoldTime", //
    "ExecuteAndResultSetHoldTime", //
    "FetchRowCountHistogram", //
    "EffectedRowCountHistogram", //
    "ExecuteAndResultHoldTimeHistogram", //
    "EffectedRowCountMax", //
    "FetchRowCountMax", "ClobOpenCount", //
    "BlobOpenCount", //
    "ReadStringLength", //
    "ReadBytesLength", //
    "InputStreamOpenCount", //
    "ReaderOpenCount", //
    "HASH" };
    String[] indexDescriptions = indexNames;
    COMPOSITE_TYPE = new CompositeType("SqlStatistic", "Sql Statistic", indexNames, indexDescriptions, indexTypes);
    return COMPOSITE_TYPE;
}
Also used : ArrayType(javax.management.openmbean.ArrayType) OpenType(javax.management.openmbean.OpenType) CompositeType(javax.management.openmbean.CompositeType)

Example 60 with CompositeType

use of javax.management.openmbean.CompositeType in project druid by alibaba.

the class JdbcStatManager method getDataSourceList.

@Override
public TabularData getDataSourceList() throws JMException {
    CompositeType rowType = getDataSourceCompositeType();
    String[] indexNames = rowType.keySet().toArray(new String[rowType.keySet().size()]);
    TabularType tabularType = new TabularType("DataSourceStat", "DataSourceStat", rowType, indexNames);
    TabularData data = new TabularDataSupport(tabularType);
    {
        final ConcurrentMap<String, DataSourceProxyImpl> dataSources = DruidDriver.getProxyDataSources();
        for (DataSourceProxyImpl dataSource : dataSources.values()) {
            data.put(dataSource.getCompositeData());
        }
    }
    final Set<DruidDataSource> dataSources = DruidDataSourceStatManager.getDruidDataSourceInstances();
    for (DruidDataSource dataSource : dataSources) {
        data.put(dataSource.getCompositeData());
    }
    return data;
}
Also used : DataSourceProxyImpl(com.alibaba.druid.proxy.jdbc.DataSourceProxyImpl) TabularDataSupport(javax.management.openmbean.TabularDataSupport) TabularType(javax.management.openmbean.TabularType) ConcurrentMap(java.util.concurrent.ConcurrentMap) DruidDataSource(com.alibaba.druid.pool.DruidDataSource) CompositeType(javax.management.openmbean.CompositeType) TabularData(javax.management.openmbean.TabularData)

Aggregations

CompositeType (javax.management.openmbean.CompositeType)82 CompositeDataSupport (javax.management.openmbean.CompositeDataSupport)55 CompositeData (javax.management.openmbean.CompositeData)50 TabularDataSupport (javax.management.openmbean.TabularDataSupport)50 TabularData (javax.management.openmbean.TabularData)47 TabularType (javax.management.openmbean.TabularType)27 OpenType (javax.management.openmbean.OpenType)23 OpenDataException (javax.management.openmbean.OpenDataException)22 Map (java.util.Map)20 ObjectName (javax.management.ObjectName)7 EndpointUtilizationStatistics (org.apache.camel.spi.EndpointUtilizationStatistics)7 MBeanServer (javax.management.MBeanServer)6 ArrayType (javax.management.openmbean.ArrayType)6 ConcurrentMap (java.util.concurrent.ConcurrentMap)5 MBeanException (javax.management.MBeanException)5 NotCompliantMBeanException (javax.management.NotCompliantMBeanException)5 DruidDataSource (com.alibaba.druid.pool.DruidDataSource)3 DataSourceProxyImpl (com.alibaba.druid.proxy.jdbc.DataSourceProxyImpl)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3