Search in sources :

Example 1 with DataSourceMonitorAccessor

use of com.navercorp.pinpoint.plugin.commons.dbcp.DataSourceMonitorAccessor in project pinpoint by naver.

the class DataSourceConstructorInterceptor method after.

@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
    if (!InterceptorUtils.isSuccess(throwable)) {
        return;
    }
    final BasicDataSource basicDataSource = getBasicDatasource(target);
    if (basicDataSource instanceof DataSourceMonitorAccessor) {
        DbcpDataSourceMonitor dataSourceMonitor = new DbcpDataSourceMonitor(basicDataSource);
        dataSourceMonitorRegistry.register(dataSourceMonitor);
        ((DataSourceMonitorAccessor) basicDataSource)._$PINPOINT$_setDataSourceMonitor(dataSourceMonitor);
    }
}
Also used : DbcpDataSourceMonitor(com.navercorp.pinpoint.plugin.commons.dbcp.DbcpDataSourceMonitor) DataSourceMonitorAccessor(com.navercorp.pinpoint.plugin.commons.dbcp.DataSourceMonitorAccessor) BasicDataSource(org.apache.commons.dbcp.BasicDataSource)

Example 2 with DataSourceMonitorAccessor

use of com.navercorp.pinpoint.plugin.commons.dbcp.DataSourceMonitorAccessor in project pinpoint by naver.

the class DataSourceCloseInterceptor method before.

@Override
public void before(Object target, Object[] args) {
    if (target instanceof DataSourceMonitorAccessor) {
        final DataSourceMonitorAccessor dataSourceMonitorAccessor = (DataSourceMonitorAccessor) target;
        final DbcpDataSourceMonitor dataSourceMonitor = dataSourceMonitorAccessor._$PINPOINT$_getDataSourceMonitor();
        if (dataSourceMonitor != null) {
            dataSourceMonitorAccessor._$PINPOINT$_setDataSourceMonitor(null);
            dataSourceMonitor.close();
            dataSourceMonitorRegistry.unregister(dataSourceMonitor);
        }
    }
}
Also used : DbcpDataSourceMonitor(com.navercorp.pinpoint.plugin.commons.dbcp.DbcpDataSourceMonitor) DataSourceMonitorAccessor(com.navercorp.pinpoint.plugin.commons.dbcp.DataSourceMonitorAccessor)

Example 3 with DataSourceMonitorAccessor

use of com.navercorp.pinpoint.plugin.commons.dbcp.DataSourceMonitorAccessor in project pinpoint by pinpoint-apm.

the class DataSourceConstructorInterceptor method after.

@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
    if (!InterceptorUtils.isSuccess(throwable)) {
        return;
    }
    final BasicDataSource basicDataSource = getBasicDatasource(target);
    if (basicDataSource instanceof DataSourceMonitorAccessor) {
        DbcpDataSourceMonitor dataSourceMonitor = new DbcpDataSourceMonitor(basicDataSource);
        dataSourceMonitorRegistry.register(dataSourceMonitor);
        ((DataSourceMonitorAccessor) basicDataSource)._$PINPOINT$_setDataSourceMonitor(dataSourceMonitor);
    }
}
Also used : DbcpDataSourceMonitor(com.navercorp.pinpoint.plugin.commons.dbcp.DbcpDataSourceMonitor) DataSourceMonitorAccessor(com.navercorp.pinpoint.plugin.commons.dbcp.DataSourceMonitorAccessor) BasicDataSource(org.apache.commons.dbcp.BasicDataSource)

Example 4 with DataSourceMonitorAccessor

use of com.navercorp.pinpoint.plugin.commons.dbcp.DataSourceMonitorAccessor in project pinpoint by pinpoint-apm.

the class DataSourceCloseInterceptor method before.

@Override
public void before(Object target, Object[] args) {
    if (target instanceof DataSourceMonitorAccessor) {
        final DataSourceMonitorAccessor dataSourceMonitorAccessor = (DataSourceMonitorAccessor) target;
        final DbcpDataSourceMonitor dataSourceMonitor = dataSourceMonitorAccessor._$PINPOINT$_getDataSourceMonitor();
        if (dataSourceMonitor != null) {
            dataSourceMonitorAccessor._$PINPOINT$_setDataSourceMonitor(null);
            dataSourceMonitor.close();
            dataSourceMonitorRegistry.unregister(dataSourceMonitor);
        }
    }
}
Also used : DbcpDataSourceMonitor(com.navercorp.pinpoint.plugin.commons.dbcp.DbcpDataSourceMonitor) DataSourceMonitorAccessor(com.navercorp.pinpoint.plugin.commons.dbcp.DataSourceMonitorAccessor)

Aggregations

DataSourceMonitorAccessor (com.navercorp.pinpoint.plugin.commons.dbcp.DataSourceMonitorAccessor)4 DbcpDataSourceMonitor (com.navercorp.pinpoint.plugin.commons.dbcp.DbcpDataSourceMonitor)4 BasicDataSource (org.apache.commons.dbcp.BasicDataSource)2