private <T> void runWriteForceAutocommit(TableReference tableRef, Function<DbWriteTable, T> runner) { try (ConnectionSupplier conns = new ConnectionSupplier(connections)) { SqlConnection conn = conns.get(); boolean autocommit; try { autocommit = conn.getUnderlyingConnection().getAutoCommit(); } catch (PalantirSqlException | SQLException e1) { throw Throwables.rewrapAndThrowUncheckedException(e1); } if (!autocommit) { runWriteFreshConnection(conns, tableRef, runner); } else { runner.apply(dbTables.createWrite(tableRef, conns)); } } }
private <T> void runWriteForceAutocommit(TableReference tableRef, Function<DbWriteTable, T> runner) { try (ConnectionSupplier conns = new ConnectionSupplier(connections)) { SqlConnection conn = conns.get(); boolean autocommit; try { autocommit = conn.getUnderlyingConnection().getAutoCommit(); } catch (PalantirSqlException | SQLException e1) { throw Throwables.rewrapAndThrowUncheckedException(e1); } if (!autocommit) { runWriteFreshConnection(conns, tableRef, runner); } else { runner.apply(dbTables.createWrite(tableRef, conns)); } } }