} finally { closeSilently(ps); timerKey.stop(); for (BlobHandler cleanup : cleanups) { try {
} finally { closeSilently(ps); timerKey.stop(); for (BlobHandler cleanup : cleanups) { try {
} finally { closeSilently(ps); timerKey.stop(); for (BlobHandler cleanup : cleanups) { try {
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(); } }
@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(); } }; } }
@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$ } }
} finally { closeSilently(ps); timerKey.stop(); for (BlobHandler cleanup : cleanups) { try {
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(); } }
@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(); } }; } }
@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$ } }