@Override public final LockResult find(byte[] key) throws IOException { reset(); return doFind(key); }
@Override public final LockResult find(byte[] key) throws IOException { reset(); return doFind(key); }
@Override public final LockResult find(byte[] key) throws IOException { reset(); return doFind(key); }
private boolean txnUpdate(byte[] key, byte[] oldValue, byte[] newValue) throws IOException { Transaction txn = mDatabase.newAlwaysRedoTransaction(); try { TreeCursor c = new TxnTreeCursor(this, txn); try { c.doFind(key); if (Arrays.equals(oldValue, c.mValue)) { c.commit(newValue); return true; } else { txn.reset(); return false; } } finally { c.reset(); } } catch (Throwable e) { txn.reset(); throw e; } }
private void txnStore(byte[] key, byte[] value) throws IOException { Transaction txn = mDatabase.newAlwaysRedoTransaction(); try { TreeCursor c = new TxnTreeCursor(this, txn); try { c.mKeyOnly = true; c.doFind(key); c.commit(value); } finally { c.reset(); } } catch (Throwable e) { txn.reset(); throw e; } }
private void txnStore(byte[] key, byte[] value) throws IOException { Transaction txn = mDatabase.newAlwaysRedoTransaction(); try { TreeCursor c = new TreeCursor(this, txn); try { c.mKeyOnly = true; c.doFind(key); c.commit(value); } finally { c.reset(); } } catch (Throwable e) { txn.reset(); throw e; } }
public boolean txnUpdate(byte[] key, byte[] oldValue, byte[] newValue) throws IOException { Transaction txn = mDatabase.newAlwaysRedoTransaction(); try { TreeCursor c = new TreeCursor(this, txn); try { c.doFind(key); if (Arrays.equals(oldValue, c.mValue)) { c.commit(newValue); return true; } else { txn.reset(); return false; } } finally { c.reset(); } } catch (Throwable e) { txn.reset(); throw e; } }
private byte[] txnExchange(byte[] key, byte[] value) throws IOException { Transaction txn = mDatabase.newAlwaysRedoTransaction(); try { TreeCursor c = new TreeCursor(this, txn); try { c.doFind(key); byte[] oldValue = c.mValue; c.commit(value); return oldValue; } finally { c.reset(); } } catch (Throwable e) { txn.reset(); throw e; } }
private byte[] txnExchange(byte[] key, byte[] value) throws IOException { Transaction txn = mDatabase.newAlwaysRedoTransaction(); try { TreeCursor c = new TxnTreeCursor(this, txn); try { c.doFind(key); byte[] oldValue = c.mValue; c.commit(value); return oldValue; } finally { c.reset(); } } catch (Throwable e) { txn.reset(); throw e; } }
private boolean txnReplace(byte[] key, byte[] value) throws IOException { Transaction txn = mDatabase.newAlwaysRedoTransaction(); try { TreeCursor c = new TreeCursor(this, txn); try { c.mKeyOnly = true; c.doFind(key); if (c.mValue != null) { c.commit(value); return true; } else { txn.reset(); return false; } } finally { c.reset(); } } catch (Throwable e) { txn.reset(); throw e; } }
private boolean txnInsert(byte[] key, byte[] value) throws IOException { Transaction txn = mDatabase.newAlwaysRedoTransaction(); try { TreeCursor c = new TxnTreeCursor(this, txn); try { c.mKeyOnly = true; c.doFind(key); if (c.mValue == null) { c.commit(value); return true; } else { txn.reset(); return false; } } finally { c.reset(); } } catch (Throwable e) { txn.reset(); throw e; } }
private boolean txnInsert(byte[] key, byte[] value) throws IOException { Transaction txn = mDatabase.newAlwaysRedoTransaction(); try { TreeCursor c = new TreeCursor(this, txn); try { c.mKeyOnly = true; c.doFind(key); if (c.mValue == null) { c.commit(value); return true; } else { txn.reset(); return false; } } finally { c.reset(); } } catch (Throwable e) { txn.reset(); throw e; } }
private boolean txnReplace(byte[] key, byte[] value) throws IOException { Transaction txn = mDatabase.newAlwaysRedoTransaction(); try { TreeCursor c = new TxnTreeCursor(this, txn); try { c.mKeyOnly = true; c.doFind(key); if (c.mValue != null) { c.commit(value); return true; } else { txn.reset(); return false; } } finally { c.reset(); } } catch (Throwable e) { txn.reset(); throw e; } }