
com.alterioncorp.perfjdbc.sql.PerfXADataSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of perf-jdbc Show documentation
Show all versions of perf-jdbc Show documentation
Wrapper JDBC driver that monitors time spent inside JDBC code by thread.
JDBC driver URL:
jdbc:alterion:perf://class=<TARGET_DRIVER_CLASS>|url=<TARGET_JDBC_URL>
To get the time in millis spent inside JDBC for thread:
StopWatch.getTime()
The newest version!
package com.alterioncorp.perfjdbc.sql;
import java.sql.SQLException;
import javax.sql.XAConnection;
import javax.sql.XADataSource;
import com.alterioncorp.perfjdbc.PerfProxy;
import com.alterioncorp.perfjdbc.PerfProxyFactory;
import com.alterioncorp.perfjdbc.StopWatch;
public class PerfXADataSource extends PerfCommonDataSource implements XADataSource, PerfProxy {
public PerfXADataSource() {
super();
}
public PerfXADataSource(XADataSource targetDataSource) {
super(targetDataSource);
}
public PerfXADataSource(String targetJndi) {
super(targetJndi);
}
@Override
public XAConnection getXAConnection() throws SQLException {
StopWatch.start();
try {
return PerfProxyFactory.createProxy(
XAConnection.class,
this.getTargetXADataSource().getXAConnection());
}
finally {
StopWatch.stop();
}
}
@Override
public XAConnection getXAConnection(String user, String password)
throws SQLException {
StopWatch.start();
try {
return PerfProxyFactory.createProxy(
XAConnection.class,
this.getTargetXADataSource().getXAConnection(user, password));
}
finally {
StopWatch.stop();
}
}
protected final XADataSource getTargetXADataSource() {
return (XADataSource)this.getTargetCommonDataSource();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy