tripleBatch.clear();
tripleBatch.clear();
/** * Undoes all changes made in the current transaction * and releases any database locks currently held * by this <code>Connection</code> object. This method should be * used only when auto-commit mode has been disabled. * * @exception java.sql.SQLException if a database access error occurs, * this method is called while participating in a distributed transaction, * this method is called on a closed connection or this * <code>Connection</code> object is in auto-commit mode * @see #setAutoCommit */ public void rollback() throws SQLException { if (tripleBatch != null && tripleBatch.size() > 0) { synchronized (tripleBatch) { for(KiWiTriple triple : tripleBatch) { triple.setId(-1L); } tripleBatch.clear(); } } deletedStatementsLog = BloomFilter.create(Funnels.longFunnel(), 100000); if(connection != null && !connection.isClosed()) { connection.rollback(); } this.transactionId = getNextSequence(); }
/** * Undoes all changes made in the current transaction * and releases any database locks currently held * by this <code>Connection</code> object. This method should be * used only when auto-commit mode has been disabled. * * @exception java.sql.SQLException if a database access error occurs, * this method is called while participating in a distributed transaction, * this method is called on a closed connection or this * <code>Connection</code> object is in auto-commit mode * @see #setAutoCommit */ public void rollback() throws SQLException { if (tripleBatch != null && tripleBatch.size() > 0) { synchronized (tripleBatch) { for(KiWiTriple triple : tripleBatch) { triple.setId(-1L); } tripleBatch.clear(); } } deletedStatementsLog = BloomFilter.create(Funnels.longFunnel(), 100000); if(connection != null && !connection.isClosed()) { connection.rollback(); } this.transactionId = getNextSequence(); }
@Override public Void run() throws SQLException { PreparedStatement insertTriple = getPreparedStatement("store.triple"); insertTriple.clearParameters(); insertTriple.clearBatch(); synchronized (tripleBatch) { for(KiWiTriple triple : tripleBatch) { // retrieve a new triple ID and set it in the object if(triple.getId() < 0) { triple.setId(getNextSequence()); } insertTriple.setLong(1,triple.getId()); insertTriple.setLong(2,triple.getSubject().getId()); insertTriple.setLong(3,triple.getPredicate().getId()); insertTriple.setLong(4,triple.getObject().getId()); if(triple.getContext() != null) { insertTriple.setLong(5,triple.getContext().getId()); } else { insertTriple.setNull(5, Types.BIGINT); } insertTriple.setBoolean(6,triple.isInferred()); insertTriple.setTimestamp(7, new Timestamp(triple.getCreated().getTime())); insertTriple.addBatch(); } } insertTriple.executeBatch(); tripleBatch.clear(); return null; } });
@Override public Void run() throws SQLException { PreparedStatement insertTriple = getPreparedStatement("store.triple"); insertTriple.clearParameters(); insertTriple.clearBatch(); synchronized (tripleBatch) { for(KiWiTriple triple : tripleBatch) { // retrieve a new triple ID and set it in the object if(triple.getId() < 0) { triple.setId(getNextSequence()); } insertTriple.setLong(1,triple.getId()); insertTriple.setLong(2,triple.getSubject().getId()); insertTriple.setLong(3,triple.getPredicate().getId()); insertTriple.setLong(4,triple.getObject().getId()); if(triple.getContext() != null) { insertTriple.setLong(5,triple.getContext().getId()); } else { insertTriple.setNull(5, Types.BIGINT); } insertTriple.setBoolean(6,triple.isInferred()); insertTriple.setTimestamp(7, new Timestamp(triple.getCreated().getTime())); insertTriple.addBatch(); } } insertTriple.executeBatch(); tripleBatch.clear(); return null; } });