use of com.palantir.nexus.db.monitoring.timer.SqlTimer in project atlasdb by palantir.
the class SQL method fromResultSet.
public AgnosticLightResultSet fromResultSet(PreparedStatement preparedStatement, ResultSet resultSet, DBType dbType, String queryString) {
FinalSQLString sqlString = SQLString.getUnregisteredQuery(queryString);
String timingModule = "visitResultSet";
ResultSetMetaData metaData = ResultSets.getMetaData(resultSet);
SqlTimer sqlTimer = getSqlTimer();
// $NON-NLS-1$
ResourceCreationLocation creationException = new ResourceCreationLocation("This is where the ResultsSet was created");
return new AgnosticLightResultSetImpl(resultSet, dbType, metaData, preparedStatement, timingModule, sqlString, sqlTimer, creationException);
}
use of com.palantir.nexus.db.monitoring.timer.SqlTimer in project atlasdb by palantir.
the class ConnectionManagerAwareDbKvs method getSimpleTimedSqlConnectionSupplier.
private static SqlConnectionSupplier getSimpleTimedSqlConnectionSupplier(ReentrantManagedConnectionSupplier connectionSupplier) {
Supplier<Connection> supplier = () -> connectionSupplier.get();
SQL sql = new SQL() {
@Override
protected SqlConfig getSqlConfig() {
return new SqlConfig() {
@Override
public boolean isSqlCancellationDisabled() {
return false;
}
protected Iterable<SqlTimer> getSqlTimers() {
return ImmutableList.of(SqlTimers.createDurationSqlTimer(), SqlTimers.createSqlStatsSqlTimer());
}
@Override
public SqlTimer getSqlTimer() {
return SqlTimers.createCombinedSqlTimer(getSqlTimers());
}
};
}
};
return new SqlConnectionSupplier() {
@Override
public SqlConnection get() {
return new ConnectionBackedSqlConnectionImpl(supplier.get(), () -> {
throw new UnsupportedOperationException("This SQL connection does not provide reliable timestamp.");
}, new SqlConnectionHelper(sql));
}
@Override
public void close() {
connectionSupplier.close();
}
};
}
Aggregations