public static void checkDruidSqlCache()

in appactive-java-client/client-bridge/client-bridge-db-mysql/src/main/java/io/appactive/db/mysql/utils/SQLCacheCheckUtil.java [40:68]


    public static void checkDruidSqlCache() {
        MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
        try {
            Set<ObjectInstance> instances = mbeanServer
                .queryMBeans(new ObjectName("com.alibaba.druid:type=DruidDataSource,*"), null);
            Iterator<ObjectInstance> iterator = instances.iterator();
            while (iterator.hasNext()) {
                ObjectInstance dataSource = iterator.next();
                MBeanInfo mBeanInfo = mbeanServer.getMBeanInfo(dataSource.getObjectName());
                MBeanAttributeInfo[] mBeanAttributeInfos = mBeanInfo.getAttributes();
                for (MBeanAttributeInfo mBeanAttributeInfo : mBeanAttributeInfos) {
                    String attributeInfoName = mBeanAttributeInfo.getName();
                    checkPoolPreparedStatements(mbeanServer, dataSource, mBeanAttributeInfo, attributeInfoName);
                }
            }
        } catch (ReflectionException e) {
            // ignore such exception
        } catch (InstanceNotFoundException e) {
            // ignore such exception
        } catch (IntrospectionException e) {
            // ignore such exception
        } catch (AttributeNotFoundException e) {
            // ignore such exception
        } catch (MBeanException e) {
            // ignore such exception
        } catch (MalformedObjectNameException e) {
            // ignore such exception
        }
    }