/** * @param cacheCtx Cache context. * @param key Key to add to read set. * @param op Operation. * @param val Value. * @param drVer Data center replication version. * @param skipStore Skip store flag. * @throws IgniteCheckedException If failed. * @return {@code True} if entry has been enlisted. */ public boolean addEntry( GridCacheContext cacheCtx, IgniteTxKey key, GridCacheOperation op, CacheObject val, @Nullable GridCacheVersion drVer, boolean skipStore) throws IgniteCheckedException { checkInternal(key); GridNearCacheEntry cached = cacheCtx.near().peekExx(key.key()); try { if (cached == null) { evicted.add(key); return false; } else { cached.unswap(); CacheObject peek = cached.peek(true, false, false, null); if (peek == null && cached.evictInternal(false, xidVer, null)) { cached.context().cache().removeIfObsolete(key.key()); evicted.add(key); return false; } else { IgniteTxEntry txEntry = new IgniteTxEntry(cacheCtx, this, op, val, -1L, -1L, cached, drVer, skipStore); txState.addWriteEntry(key, txEntry); return true; } } } catch (GridCacheEntryRemovedException ignore) { evicted.add(key); if (log.isDebugEnabled()) log.debug( "Got removed entry when adding reads to remote transaction (will ignore): " + cached); return false; } }
/** {@inheritDoc} */ @Override protected GridCacheEntryEx entryEx(GridCacheContext cacheCtx, IgniteTxKey key) { if (cacheCtx.isColocated()) { IgniteTxEntry txEntry = entry(key); if (txEntry == null) return cacheCtx.colocated().entryExx(key.key(), topologyVersion(), true); GridCacheEntryEx cached = txEntry.cached(); assert cached != null; if (cached.detached()) return cached; if (cached.obsoleteVersion() != null) { cached = cacheCtx.colocated().entryExx(key.key(), topologyVersion(), true); txEntry.cached(cached); } return cached; } else return cacheCtx.cache().entryEx(key.key()); }
void recheck() { for (Iterator<IgniteTxKey> it = pendingLocks.keySet().iterator(); it.hasNext(); ) { IgniteTxKey key = it.next(); GridCacheContext cacheCtx = cctx.cacheContext(key.cacheId()); GridCacheEntryEx entry = cacheCtx.cache().peekEx(key.key()); if (entry == null) it.remove(); else recheck(entry); } if (log.isDebugEnabled()) log.debug("After rechecking finished future: " + this); if (pendingLocks.isEmpty()) { if (exchLog.isDebugEnabled()) exchLog.debug("Finish lock future is done: " + this); onDone(); } }