private <A> A getNoLock(long recid, Serializer<A> serializer) { if (fullTx) { Fun.Tuple2 tu = mod.get(recid); if (tu != null) { if (tu.a == TOMBSTONE) return null; return (A) tu.a; } } Object oldVal = old.get(recid); if (oldVal != null) { if (oldVal == TOMBSTONE) return null; return (A) oldVal; } return TxEngine.this.get(recid, serializer); }
public void lock(final long recid) { if (CC.LOG_LOCKS) Utils.LOG.finest("TRYLOCK R:" + recid + " T:" + Thread.currentThread().getId()); // feel free to rewrite, if you know better (more efficient) way if (CC.ASSERT && locks.get(recid) == Thread.currentThread()) { // check node is not already locked by this thread throw new InternalError("node already locked by current thread: " + recid); } while (locks.putIfAbsent(recid, Thread.currentThread()) != null) { Thread.yield(); } if (CC.LOG_LOCKS) Utils.LOG.finest("LOCK R:" + recid + " T:" + Thread.currentThread().getId()); }