Search in sources :

Example 1 with Dbcp2DataSourceMonitor

use of com.navercorp.pinpoint.plugin.commons.dbcp2.Dbcp2DataSourceMonitor in project pinpoint by naver.

the class DataSourceCloseInterceptor method before.

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

Example 2 with Dbcp2DataSourceMonitor

use of com.navercorp.pinpoint.plugin.commons.dbcp2.Dbcp2DataSourceMonitor 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;
    }
    if ((target instanceof DataSourceMonitorAccessor) && (target instanceof BasicDataSource)) {
        Dbcp2DataSourceMonitor dbcpDataSourceMonitor = new Dbcp2DataSourceMonitor((BasicDataSource) target);
        dataSourceMonitorRegistry.register(dbcpDataSourceMonitor);
        ((DataSourceMonitorAccessor) target)._$PINPOINT$_setDataSourceMonitor(dbcpDataSourceMonitor);
    }
}
Also used : Dbcp2DataSourceMonitor(com.navercorp.pinpoint.plugin.commons.dbcp2.Dbcp2DataSourceMonitor) DataSourceMonitorAccessor(com.navercorp.pinpoint.plugin.commons.dbcp2.DataSourceMonitorAccessor) BasicDataSource(org.apache.commons.dbcp2.BasicDataSource)

Aggregations

DataSourceMonitorAccessor (com.navercorp.pinpoint.plugin.commons.dbcp2.DataSourceMonitorAccessor)2 Dbcp2DataSourceMonitor (com.navercorp.pinpoint.plugin.commons.dbcp2.Dbcp2DataSourceMonitor)2 BasicDataSource (org.apache.commons.dbcp2.BasicDataSource)1