public static DurationSqlTimer createDurationSqlTimer() { return new DurationSqlTimer(); }
public static SqlStatsSqlTimer createSqlStatsSqlTimer() { return new SqlStatsSqlTimer(); }
public static CombinedSqlTimer createCombinedSqlTimer(Iterable<SqlTimer> sqlTimers) { return new CombinedSqlTimer(ImmutableList.copyOf(sqlTimers)); } }
@Override final public Handle start(String module, String sqlKey, String rawSql) { final List<Handle> handles = Lists.newArrayListWithCapacity(sqlTimers.size()); for (SqlTimer sqlTimer : sqlTimers) { handles.add(sqlTimer.start(module, sqlKey, rawSql)); } return () -> { for (Handle handle : handles) { handle.stop(); } }; } }
/** * @see AgnosticIterator for caveats on use. * Note this expects to be called by visitAndClose()! If not, the timer will never get * initialized and close() will throw an exception. */ @Override public Iterator<AgnosticLightResultRow> iterator() { this.timerKey = sqlTimerFactory.start(timingModule, sqlString.getKey(), sqlString.getQuery()); return new AgnosticIterator(); }
@Override public void close() { timerKey.stop(); try { stmt.close(); results.close(); hasBeenClosed = true; long elapsed = System.currentTimeMillis() - creationLocation.getCreatingThreadInfo().getTimestamp(); log.debug("Closed {} after {}ms", this, elapsed); } catch(SQLException sqlex) { log.error("Caught SQLException", sqlex); //$NON-NLS-1$ } }
private <T> T wrapPreparedStatement(final Connection c, final FinalSQLString query, final Object[] vs, PreparedStatementVisitor<T> visitor, String description, AutoClose autoClose) throws PalantirSqlException, PalantirInterruptedException { SqlTimer.Handle timerKey = getSqlTimer().start(description, query.getKey(), query.getQuery()); PreparedStatement ps = null; try { ps = BasicSQLUtils.runUninterruptably( executeStatementExecutor, () -> createPreparedStatement(c, query.getQuery(), vs), "SQL createPreparedStatement", c); return visitor.visit(ps); } catch (PalantirSqlException sqle) { throw wrapSQLExceptionWithVerboseLogging(sqle, query.getQuery(), vs); } finally { closeSilently(ps, autoClose); timerKey.stop(); } }
public static DurationSqlTimer createDurationSqlTimer() { return new DurationSqlTimer(); }
public static SqlStatsSqlTimer createSqlStatsSqlTimer() { return new SqlStatsSqlTimer(); }
public static CombinedSqlTimer createCombinedSqlTimer(Iterable<SqlTimer> sqlTimers) { return new CombinedSqlTimer(ImmutableList.copyOf(sqlTimers)); } }
/** * @see AgnosticIterator for caveats on use. * Note this expects to be called by visitAndClose()! If not, the timer will never get * initialized and close() will throw an exception. */ @Override public Iterator<AgnosticLightResultRow> iterator() { this.timerKey = sqlTimerFactory.start(timingModule, sqlString.getKey(), sqlString.getQuery()); return new AgnosticIterator(); }
@Override public void close() { timerKey.stop(); try { stmt.close(); results.close(); hasBeenClosed = true; long elapsed = System.currentTimeMillis() - creationLocation.getCreatingThreadInfo().getTimestamp(); log.debug("Closed {} after {}ms", this, elapsed); } catch(SQLException sqlex) { log.error("Caught SQLException", sqlex); //$NON-NLS-1$ } }
List<BlobHandler> cleanups = Lists.newArrayList(); PreparedStatement ps = null; SqlTimer.Handle timerKey = getSqlTimer().start("updateMany(" + vs.length + ")", sql.getKey(), sql.getQuery()); //$NON-NLS-1$ //$NON-NLS-2$ try { ps = c.prepareStatement(sql.getQuery()); } finally { closeSilently(ps); timerKey.stop(); for (BlobHandler cleanup : cleanups) { try {
PreparedStatement ps = null; SqlTimer.Handle timerKey = getSqlTimer().start("insertMany(" + vs.length + ")", sql.getKey(), sql.getQuery()); //$NON-NLS-1$ //$NON-NLS-2$ List<BlobHandler> cleanups = Lists.newArrayList(); try { } finally { closeSilently(ps); timerKey.stop(); for (BlobHandler cleanup : cleanups) { try {
@Override final public Handle start(String module, String sqlKey, String rawSql) { final List<Handle> handles = Lists.newArrayListWithCapacity(sqlTimers.size()); for (SqlTimer sqlTimer : sqlTimers) { handles.add(sqlTimer.start(module, sqlKey, rawSql)); } return () -> { for (Handle handle : handles) { handle.stop(); } }; } }
private <T> T wrapPreparedStatement(final Connection c, final FinalSQLString query, final Object[] vs, PreparedStatementVisitor<T> visitor, String description, AutoClose autoClose) throws PalantirSqlException, PalantirInterruptedException { SqlTimer.Handle timerKey = getSqlTimer().start(description, query.getKey(), query.getQuery()); PreparedStatement ps = null; try { ps = BasicSQLUtils.runUninterruptably( executeStatementExecutor, () -> createPreparedStatement(c, query.getQuery(), vs), "SQL createPreparedStatement", c); return visitor.visit(ps); } catch (PalantirSqlException sqle) { throw wrapSQLExceptionWithVerboseLogging(sqle, query.getQuery(), vs); } finally { closeSilently(ps, autoClose); timerKey.stop(); } }
List<BlobHandler> cleanups = Lists.newArrayList(); PreparedStatement ps = null; SqlTimer.Handle timerKey = getSqlTimer().start("updateMany(" + vs.length + ")", sql.getKey(), sql.getQuery()); //$NON-NLS-1$ //$NON-NLS-2$ try { ps = c.prepareStatement(sql.getQuery()); } finally { closeSilently(ps); timerKey.stop(); for (BlobHandler cleanup : cleanups) { try {
PreparedStatement ps = null; SqlTimer.Handle timerKey = getSqlTimer().start("insertMany(" + vs.length + ")", sql.getKey(), sql.getQuery()); //$NON-NLS-1$ //$NON-NLS-2$ List<BlobHandler> cleanups = Lists.newArrayList(); try { } finally { closeSilently(ps); timerKey.stop(); for (BlobHandler cleanup : cleanups) { try {