@Test public void timedOutDeleteNoGhost() throws Exception { View ix = openIndex("foo"); byte[] key = "hello".getBytes(); byte[] value1 = "world".getBytes(); ix.store(null, key, value1); Transaction txn = mDb.newTransaction(); ix.lockExclusive(txn, key); ix.store(Transaction.BOGUS, key, null); assertEquals(null, ix.load(Transaction.BOGUS, key)); try { ix.load(null, key); fail(); } catch (LockTimeoutException e) { } Transaction txn2 = mDb.newTransaction(); try { ix.load(txn2, key); fail(); } catch (LockTimeoutException e) { } txn2.lockMode(LockMode.UPGRADABLE_READ); try { ix.load(txn2, key); fail(); } catch (LockTimeoutException e) { } txn2.lockMode(LockMode.REPEATABLE_READ); try { ix.load(txn2, key); fail(); } catch (LockTimeoutException e) { } txn2.lockMode(LockMode.READ_COMMITTED); try { ix.load(txn2, key); fail(); } catch (LockTimeoutException e) { } txn2.lockMode(LockMode.READ_UNCOMMITTED); assertEquals(null, ix.load(txn2, key)); txn2.lockMode(LockMode.UNSAFE); assertEquals(null, ix.load(txn2, key)); txn.commit(); assertEquals(null, ix.load(null, key)); }
public void run() { try { Transaction txn = mDb.newTransaction(); if (mNoGhost) { mIx.lockExclusive(txn, mKey); mIx.store(Transaction.BOGUS, mKey, mValue); } else { mIx.store(txn, mKey, mValue); } synchronized (this) { mSleeping = true; notify(); } Thread.sleep(500); txn.commit(); } catch (Exception e) { } }